Skip to content

Commit a1783e6

Browse files
author
ug
committed
fixed appearance proxy issues:
- CTAssetsPageView did not apply backgroundColor - CTAssetsViewControllerTransition use page view background color as transitions background color
1 parent 834fe74 commit a1783e6

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CTAssetsPickerController/CTAssetsPageView.m

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ - (void)setupViews
6464
- (void)setPageBackgroundColor:(UIColor *)backgroundColor
6565
{
6666
_pageBackgroundColor = (backgroundColor) ? backgroundColor : CTAssetsPageViewPageBackgroundColor;
67+
self.backgroundColor = _pageBackgroundColor;
6768
}
6869
- (void)setFullscreenBackgroundColor:(UIColor *)backgroundColor
6970
{

CTAssetsPickerController/CTAssetsViewControllerTransition.m

100644100755
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ of this software and associated documentation files (the "Software"), to deal
2929
#import "CTAssetsPageViewController.h"
3030
#import "CTAssetItemViewController.h"
3131
#import "CTAssetScrollView.h"
32-
32+
#import "CTAssetsPageView.h"
3333

3434

3535

@@ -54,7 +54,13 @@ - (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)t
5454
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
5555
{
5656
UIView *containerView = [transitionContext containerView];
57-
containerView.backgroundColor = [UIColor whiteColor];
57+
58+
UIColor *bgColor = [[CTAssetsPageView appearance] pageBackgroundColor];
59+
if (bgColor) {
60+
containerView.backgroundColor = bgColor;
61+
} else {
62+
containerView.backgroundColor = [UIColor whiteColor];
63+
}
5864

5965
if (self.operation == UINavigationControllerOperationPush)
6066
{
@@ -94,7 +100,7 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionCo
94100
// Create the mask
95101
UIView *mask = [[UIView alloc] initWithFrame:startBounds];
96102
mask.backgroundColor = [UIColor whiteColor];
97-
103+
98104
// Prepare transition
99105
snapshot.transform = CGAffineTransformMakeScale(startScale, startScale);;
100106
snapshot.layer.mask = mask.layer;
@@ -137,7 +143,7 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionCo
137143
// Scroll to index path
138144
[toVC.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
139145
[toVC.collectionView layoutIfNeeded];
140-
146+
141147
UIView *cellView = [toVC.collectionView cellForItemAtIndexPath:indexPath];
142148
CTAssetScrollView *scrollView = iVC.view.subviews[0];
143149
UIImageView *imageView = scrollView.imageView;
@@ -158,7 +164,7 @@ - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionCo
158164
float height = snapshot.bounds.size.height;
159165
float length = MIN(width, height);
160166
CGRect endBounds = CGRectMake((width-length)/2, (height-length)/2, length, length);
161-
167+
162168
UIView *mask = [[UIView alloc] initWithFrame:snapshot.bounds];
163169
mask.backgroundColor = [UIColor whiteColor];
164170

@@ -221,7 +227,7 @@ - (UIView *)resizedSnapshot:(UIImageView *)imageView
221227
UIGraphicsBeginImageContextWithOptions(size, YES, 0);
222228

223229
[[UIColor whiteColor] set];
224-
UIRectFill(CGRectMake(0, 0, size.width, size.height));
230+
UIRectFill(CGRectMake(0, 0, size.width, size.height));
225231

226232
[imageView.image drawInRect:CGRectMake(0, 0, size.width, size.height)];
227233
UIImage *resized = UIGraphicsGetImageFromCurrentImageContext();

0 commit comments

Comments
 (0)