diff --git a/CTAssetsPickerController/CTAssetCollectionViewController.m b/CTAssetsPickerController/CTAssetCollectionViewController.m index 9d34941a..0daf3c61 100644 --- a/CTAssetsPickerController/CTAssetCollectionViewController.m +++ b/CTAssetsPickerController/CTAssetCollectionViewController.m @@ -68,7 +68,6 @@ - (instancetype)init if (self = [super initWithStyle:UITableViewStylePlain]) { _imageManager = [PHCachingImageManager new]; - [self addNotificationObserver]; } diff --git a/CTAssetsPickerController/CTAssetItemViewController.m b/CTAssetsPickerController/CTAssetItemViewController.m index 24dfe763..24000d66 100644 --- a/CTAssetsPickerController/CTAssetItemViewController.m +++ b/CTAssetsPickerController/CTAssetItemViewController.m @@ -24,6 +24,7 @@ of this software and associated documentation files (the "Software"), to deal */ + #import #import "CTAssetsPickerController.h" #import "CTAssetItemViewController.h" @@ -33,6 +34,8 @@ of this software and associated documentation files (the "Software"), to deal #import "PHImageManager+CTAssetsPickerController.h" + + @interface CTAssetItemViewController () @property (nonatomic, weak) CTAssetsPickerController *picker; @@ -50,6 +53,9 @@ @interface CTAssetItemViewController () @end + + + @implementation CTAssetItemViewController + (CTAssetItemViewController *)assetItemViewControllerForAsset:(PHAsset *)asset @@ -136,7 +142,7 @@ - (void)setupViews { CTAssetScrollView *scrollView = [CTAssetScrollView newAutoLayoutView]; scrollView.allowsSelection = self.allowsSelection; - + self.scrollView = scrollView; [self.view addSubview:self.scrollView]; [self.view layoutIfNeeded]; @@ -202,7 +208,7 @@ - (void)requestAssetImage // this image is set for transition animation self.image = image; - + dispatch_async(dispatch_get_main_queue(), ^{ NSError *error = info[PHImageErrorKey]; @@ -231,7 +237,7 @@ - (PHImageRequestOptions *)imageRequestOptions [self.scrollView setProgress:progress]; }); }; - + return options; } diff --git a/CTAssetsPickerController/CTAssetScrollView.m b/CTAssetsPickerController/CTAssetScrollView.m index 0e1fb54c..5ad9b9a1 100644 --- a/CTAssetsPickerController/CTAssetScrollView.m +++ b/CTAssetsPickerController/CTAssetScrollView.m @@ -24,7 +24,6 @@ of this software and associated documentation files (the "Software"), to deal */ - #import #import "CTAssetScrollView.h" #import "CTAssetPlayButton.h" @@ -33,6 +32,8 @@ of this software and associated documentation files (the "Software"), to deal #import "UIImage+CTAssetsPickerController.h" + + NSString * const CTAssetScrollViewDidTapNotification = @"CTAssetScrollViewDidTapNotification"; NSString * const CTAssetScrollViewPlayerWillPlayNotification = @"CTAssetScrollViewPlayerWillPlayNotification"; NSString * const CTAssetScrollViewPlayerWillPauseNotification = @"CTAssetScrollViewPlayerWillPauseNotification"; @@ -289,7 +290,7 @@ - (void)bind:(PHAsset *)asset image:(UIImage *)image requestInfo:(NSDictionary * self.playButton.hidden = [asset ctassetsPickerIsPhoto]; BOOL isDegraded = [info[PHImageResultIsDegradedKey] boolValue]; - + if (self.image == nil || !isDegraded) { BOOL zoom = (!self.image); @@ -347,6 +348,7 @@ - (void)unbindPlayerItem } + #pragma mark - Upate zoom scales - (void)updateZoomScalesAndZoom:(BOOL)zoom diff --git a/CTAssetsPickerController/CTAssetsGridViewController.h b/CTAssetsPickerController/CTAssetsGridViewController.h index a2cf7842..34d68fec 100644 --- a/CTAssetsPickerController/CTAssetsGridViewController.h +++ b/CTAssetsPickerController/CTAssetsGridViewController.h @@ -45,7 +45,6 @@ @property (nonatomic, weak) id delegate; @property (nonatomic, strong, nonnull) PHAssetCollection *assetCollection; - @end diff --git a/CTAssetsPickerController/CTAssetsPageViewController.m b/CTAssetsPickerController/CTAssetsPageViewController.m index 67044dcd..68382706 100644 --- a/CTAssetsPickerController/CTAssetsPageViewController.m +++ b/CTAssetsPickerController/CTAssetsPageViewController.m @@ -205,7 +205,7 @@ - (void)setPageIndex:(NSInteger)pageIndex CTAssetItemViewController *page = [CTAssetItemViewController assetItemViewControllerForAsset:asset]; page.allowsSelection = self.allowsSelection; - + [self setViewControllers:@[page] direction:UIPageViewControllerNavigationDirectionForward animated:NO @@ -234,7 +234,7 @@ - (UIViewController *)pageViewController:(UIPageViewController *)pageViewControl PHAsset *beforeAsset = self.assets[(index - 1)]; CTAssetItemViewController *page = [CTAssetItemViewController assetItemViewControllerForAsset:beforeAsset]; page.allowsSelection = self.allowsSelection; - + return page; } diff --git a/CTAssetsPickerController/CTAssetsPickerController.m b/CTAssetsPickerController/CTAssetsPickerController.m index 0f514595..7e055593 100644 --- a/CTAssetsPickerController/CTAssetsPickerController.m +++ b/CTAssetsPickerController/CTAssetsPickerController.m @@ -249,7 +249,6 @@ - (void)setupEmptyViewController - (void)setupSplitViewController { CTAssetCollectionViewController *vc = [CTAssetCollectionViewController new]; - CTAssetsNavigationController *master = [[CTAssetsNavigationController alloc] initWithRootViewController:vc]; UINavigationController *detail = [self emptyNavigationController]; UISplitViewController *svc = [UISplitViewController new]; diff --git a/CTAssetsPickerDemo/CTMasterViewController.m b/CTAssetsPickerDemo/CTMasterViewController.m index 3fb1b4a9..b09c11eb 100644 --- a/CTAssetsPickerDemo/CTMasterViewController.m +++ b/CTAssetsPickerDemo/CTMasterViewController.m @@ -166,7 +166,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (row == 5) title = @"UI tweaks"; - } if (section == 1) @@ -242,7 +241,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if (row == 5) vc = (UIViewController *)[CTUITweaksViewController new]; - } if (section == 1)