diff --git a/CTAssetsPickerController.podspec b/CTAssetsPickerController.podspec index caed5773..9e77a63c 100644 --- a/CTAssetsPickerController.podspec +++ b/CTAssetsPickerController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CTAssetsPickerController" - s.version = "2.6.0" + s.version = "2.7.0" s.summary = "iOS control that allows picking multiple photos and videos from user's photo library." s.description = <<-DESC @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Clement T" => "chiunam@gmail.com" } s.platform = :ios, '7.0' - s.source = { :git => "https://github.com/chiunam/CTAssetsPickerController.git", :tag => "v2.6.0" } + s.source = { :git => "https://github.com/chiunam/CTAssetsPickerController.git", :tag => "v2.7.0" } s.source_files = "CTAssetsPickerController/*.{h,m}" s.resource = "CTAssetsPickerController/CTAssetsPicker.xcassets/*/*.png" s.frameworks = "AssetsLibrary", "MediaPlayer" diff --git a/CTAssetsPickerController/ALAsset+accessibilityLabel.m b/CTAssetsPickerController/ALAsset+accessibilityLabel.m index 25597b6d..3ebae145 100644 --- a/CTAssetsPickerController/ALAsset+accessibilityLabel.m +++ b/CTAssetsPickerController/ALAsset+accessibilityLabel.m @@ -46,7 +46,7 @@ - (NSString *)accessibilityLabel [accessibilityLabels addObject:[self dateAccessibilityLabel]]; if (!self.defaultRepresentation) - [accessibilityLabels addObject:NSLocalizedString(@"Not available", nil)]; + [accessibilityLabels addObject:NSLocalizedStringFromTable(@"Not available", @"CTAssetsPickerController", nil)]; return [accessibilityLabels componentsJoinedByString:@", "]; } @@ -55,10 +55,10 @@ - (NSString *)accessibilityLabel - (NSString *)typeAccessibilityLabel { if ([self isVideo]) { - return NSLocalizedString(@"Video", nil); + return NSLocalizedStringFromTable(@"Video", @"CTAssetsPickerController", nil); } - return NSLocalizedString(@"Photo", nil); + return NSLocalizedStringFromTable(@"Photo", @"CTAssetsPickerController", nil); } - (NSString *)durationAccessibilityLabel @@ -73,10 +73,10 @@ - (NSString *)orientationAccessibilityLabel CGSize dimension = self.defaultRepresentation.dimensions; if (dimension.height >= dimension.width) { - return NSLocalizedString(@"Portrait", nil); + return NSLocalizedStringFromTable(@"Portrait", @"CTAssetsPickerController", nil); } - return NSLocalizedString(@"Landscape", nil); + return NSLocalizedStringFromTable(@"Landscape", @"CTAssetsPickerController", nil); } - (NSString *)dateAccessibilityLabel diff --git a/CTAssetsPickerController/CTAssetScrollView.m b/CTAssetsPickerController/CTAssetScrollView.m index 2c780d9d..381acd4f 100644 --- a/CTAssetsPickerController/CTAssetScrollView.m +++ b/CTAssetsPickerController/CTAssetScrollView.m @@ -397,7 +397,7 @@ - (void)addVideoPlayButton [button setImage:image forState:UIControlStateNormal]; [button addTarget:self action:@selector(playVideo:) forControlEvents:UIControlEventTouchUpInside]; - button.accessibilityLabel = NSLocalizedString(@"Play" , nil); + button.accessibilityLabel = NSLocalizedStringFromTable(@"Play", @"CTAssetsPickerController", nil); button.translatesAutoresizingMaskIntoConstraints = NO; self.playButton = button; diff --git a/CTAssetsPickerController/CTAssetsGroupViewCell.m b/CTAssetsPickerController/CTAssetsGroupViewCell.m index 194d5977..d445467c 100644 --- a/CTAssetsPickerController/CTAssetsGroupViewCell.m +++ b/CTAssetsPickerController/CTAssetsGroupViewCell.m @@ -78,7 +78,7 @@ - (NSString *)accessibilityLabel { NSString *label = [self.assetsGroup valueForProperty:ALAssetsGroupPropertyName]; - return [label stringByAppendingFormat:NSLocalizedString(@"%ld Photos", nil), (long)self.assetsGroup.numberOfAssets]; + return [label stringByAppendingFormat:NSLocalizedStringFromTable(@"%ld Photos", @"CTAssetsPickerController", nil), (long)self.assetsGroup.numberOfAssets]; } @end \ No newline at end of file diff --git a/CTAssetsPickerController/CTAssetsGroupViewController.m b/CTAssetsPickerController/CTAssetsGroupViewController.m index f11c0b31..14e20def 100644 --- a/CTAssetsPickerController/CTAssetsGroupViewController.m +++ b/CTAssetsPickerController/CTAssetsGroupViewController.m @@ -121,14 +121,14 @@ - (void)setupButtons if (self.picker.showsCancelButton) { self.navigationItem.leftBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"Cancel", @"CTAssetsPickerController", nil) style:UIBarButtonItemStylePlain target:self.picker action:@selector(dismiss:)]; } self.navigationItem.rightBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", nil) + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"Done", @"CTAssetsPickerController", nil) style:UIBarButtonItemStyleDone target:self.picker action:@selector(finishPickingAssets:)]; @@ -144,7 +144,7 @@ - (void)setupToolbar - (void)localize { if (!self.picker.title) - self.title = NSLocalizedString(@"Photos", nil); + self.title = NSLocalizedStringFromTable(@"Photos", @"CTAssetsPickerController", nil); else self.title = self.picker.title; } diff --git a/CTAssetsPickerController/CTAssetsPageViewController.m b/CTAssetsPickerController/CTAssetsPageViewController.m index cf783233..b83309d9 100644 --- a/CTAssetsPickerController/CTAssetsPageViewController.m +++ b/CTAssetsPickerController/CTAssetsPageViewController.m @@ -86,7 +86,7 @@ - (BOOL)prefersStatusBarHidden - (void)setTitleIndex:(NSInteger)index { NSInteger count = self.assets.count; - self.title = [NSString stringWithFormat:NSLocalizedString(@"%ld of %ld", nil), index, count]; + self.title = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%ld of %ld", @"CTAssetsPickerController", nil), index, count]; } diff --git a/CTAssetsPickerController/CTAssetsPickerController.h b/CTAssetsPickerController/CTAssetsPickerController.h index 4085f097..82e0f732 100644 --- a/CTAssetsPickerController/CTAssetsPickerController.h +++ b/CTAssetsPickerController/CTAssetsPickerController.h @@ -241,8 +241,8 @@ /** * Tells the delegate that the asset was selected. * - * @param picker The controller object managing the assets picker interface. - * @param indexPath The asset that was selected. + * @param picker The controller object managing the assets picker interface. + * @param asset The asset that was selected. * * @see assetsPickerController:didDeselectAsset: */ @@ -263,8 +263,8 @@ /** * Tells the delegate that the item at the specified path was deselected. * - * @param picker The controller object managing the assets picker interface. - * @param indexPath The asset that was deselected. + * @param picker The controller object managing the assets picker interface. + * @param asset The asset that was deselected. * * @see assetsPickerController:didSelectAsset: */ @@ -289,8 +289,8 @@ /** * Tells the delegate that asset was highlighted. * - * @param picker The controller object managing the assets picker interface. - * @param indexPath The asset that was highlighted. + * @param picker The controller object managing the assets picker interface. + * @param asset The asset that was highlighted. * * @see assetsPickerController:didUnhighlightAsset: */ @@ -300,8 +300,8 @@ /** * Tells the delegate that the highlight was removed from the asset. * - * @param picker The controller object managing the assets picker interface. - * @param indexPath The asset that had its highlight removed. + * @param picker The controller object managing the assets picker interface. + * @param asset The asset that had its highlight removed. * * @see assetsPickerController:didHighlightAsset: */ diff --git a/CTAssetsPickerController/CTAssetsPickerController.m b/CTAssetsPickerController/CTAssetsPickerController.m index c8059304..95855500 100644 --- a/CTAssetsPickerController/CTAssetsPickerController.m +++ b/CTAssetsPickerController/CTAssetsPickerController.m @@ -54,6 +54,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil self.preferredContentSize = CTAssetPickerPopoverContentSize; [self setupNavigationController]; + [self setupToolbarApperance]; [self addKeyValueObserver]; } @@ -87,9 +88,10 @@ - (UINavigationController *)createChildNavigationController return [UINavigationController alloc]; } -#pragma mark - UINavigationControllerDelegate +#pragma mark - UINavigationControllerDelegate + - (id)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC @@ -111,6 +113,17 @@ - (UINavigationController *)createChildNavigationController +#pragma mark - Toolbar Appearance + +- (void)setupToolbarApperance +{ + NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor blackColor]}; + UIBarButtonItem *barButtonItem = [UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], [CTAssetsPickerController class], nil]; + [barButtonItem setTitleTextAttributes:attributes forState:UIControlStateNormal]; +} + + + #pragma mark - ALAssetsLibrary + (ALAssetsLibrary *)defaultAssetsLibrary @@ -264,9 +277,9 @@ - (NSString *)noAssetsMessage NSString *format; if ([self isCameraDeviceAvailable]) - format = NSLocalizedString(@"You can take photos and videos using the camera, or sync photos and videos onto your %@\nusing iTunes.", nil); + format = NSLocalizedStringFromTable(@"You can take photos and videos using the camera, or sync photos and videos onto your %@\nusing iTunes.", @"CTAssetsPickerController", nil); else - format = NSLocalizedString(@"You can sync photos and videos onto your %@ using iTunes.", nil); + format = NSLocalizedStringFromTable(@"You can sync photos and videos onto your %@ using iTunes.", @"CTAssetsPickerController", nil); return [NSString stringWithFormat:format, self.deviceModel]; } @@ -351,11 +364,11 @@ - (UIView *)notAllowedView UILabel *title = [self auxiliaryLabelWithFont:[UIFont boldSystemFontOfSize:17.0] color:[UIColor colorWithRed:129.0/255.0 green:136.0/255.0 blue:148.0/255.0 alpha:1] - text:NSLocalizedString(@"This app does not have access to your photos or videos.", nil)]; + text:NSLocalizedStringFromTable(@"This app does not have access to your photos or videos.", @"CTAssetsPickerController", nil)]; UILabel *message = [self auxiliaryLabelWithFont:[UIFont systemFontOfSize:14.0] color:[UIColor colorWithRed:129.0/255.0 green:136.0/255.0 blue:148.0/255.0 alpha:1] - text:NSLocalizedString(@"You can enable access in Privacy Settings.", nil)]; + text:NSLocalizedStringFromTable(@"You can enable access in Privacy Settings.", @"CTAssetsPickerController", nil)]; UIView *centerView = [self centerViewWithViews:@[padlock, title, message]]; @@ -370,7 +383,7 @@ - (UIView *)noAssetsView UILabel *title = [self auxiliaryLabelWithFont:[UIFont systemFontOfSize:26.0] color:[UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1] - text:NSLocalizedString(@"No Photos or Videos", nil)]; + text:NSLocalizedStringFromTable(@"No Photos or Videos", @"CTAssetsPickerController", nil)]; UILabel *message = [self auxiliaryLabelWithFont:[UIFont systemFontOfSize:18.0] @@ -409,13 +422,17 @@ - (NSString *)toolbarTitle NSString *format; if (photoSelected && videoSelected) - format = NSLocalizedString(@"%ld Items Selected", nil); + format = NSLocalizedStringFromTable(@"%ld Items Selected", @"CTAssetsPickerController", nil); else if (photoSelected) - format = (self.selectedAssets.count > 1) ? NSLocalizedString(@"%ld Photos Selected", nil) : NSLocalizedString(@"%ld Photo Selected", nil); + format = (self.selectedAssets.count > 1) ? + NSLocalizedStringFromTable(@"%ld Photos Selected", @"CTAssetsPickerController", nil) : + NSLocalizedStringFromTable(@"%ld Photo Selected", @"CTAssetsPickerController", nil); else if (videoSelected) - format = (self.selectedAssets.count > 1) ? NSLocalizedString(@"%ld Videos Selected", nil) : NSLocalizedString(@"%ld Video Selected", nil); + format = (self.selectedAssets.count > 1) ? + NSLocalizedStringFromTable(@"%ld Videos Selected", @"CTAssetsPickerController", nil) : + NSLocalizedStringFromTable(@"%ld Video Selected", @"CTAssetsPickerController", nil); return [NSString stringWithFormat:format, (long)self.selectedAssets.count]; } @@ -430,11 +447,7 @@ - (UIBarButtonItem *)titleButtonItem style:UIBarButtonItemStylePlain target:nil action:nil]; - - NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor blackColor]}; - - [title setTitleTextAttributes:attributes forState:UIControlStateNormal]; - [title setTitleTextAttributes:attributes forState:UIControlStateDisabled]; + [title setEnabled:NO]; return title; diff --git a/CTAssetsPickerController/CTAssetsSupplementaryView.m b/CTAssetsPickerController/CTAssetsSupplementaryView.m index 2ec989c6..e40b5308 100644 --- a/CTAssetsPickerController/CTAssetsSupplementaryView.m +++ b/CTAssetsPickerController/CTAssetsSupplementaryView.m @@ -83,11 +83,11 @@ - (void)bind:(NSArray *)assets NSInteger numberOfPhotos = [assets filteredArrayUsingPredicate:[self predicateOfAssetType:ALAssetTypePhoto]].count; if (numberOfVideos == 0) - self.label.text = [NSString stringWithFormat:NSLocalizedString(@"%ld Photos", nil), (long)numberOfPhotos]; + self.label.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%ld Photos", @"CTAssetsPickerController", nil), (long)numberOfPhotos]; else if (numberOfPhotos == 0) - self.label.text = [NSString stringWithFormat:NSLocalizedString(@"%ld Videos", nil), (long)numberOfVideos]; + self.label.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%ld Videos", @"CTAssetsPickerController", nil), (long)numberOfVideos]; else - self.label.text = [NSString stringWithFormat:NSLocalizedString(@"%ld Photos, %ld Videos", nil), (long)numberOfPhotos, (long)numberOfVideos]; + self.label.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%ld Photos, %ld Videos", @"CTAssetsPickerController", nil), (long)numberOfPhotos, (long)numberOfVideos]; } - (NSPredicate *)predicateOfAssetType:(NSString *)type diff --git a/CTAssetsPickerController/CTAssetsViewController.m b/CTAssetsPickerController/CTAssetsViewController.m index 802f9b5f..7a7445b0 100644 --- a/CTAssetsPickerController/CTAssetsViewController.m +++ b/CTAssetsPickerController/CTAssetsViewController.m @@ -151,7 +151,7 @@ - (void)setupViews - (void)setupButtons { self.navigationItem.rightBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Done", nil) + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"Done", @"CTAssetsPickerController", nil) style:UIBarButtonItemStyleDone target:self.picker action:@selector(finishPickingAssets:)]; @@ -348,7 +348,9 @@ - (void)reloadData if (self.assets.count > 0) { [self.collectionView reloadData]; - [self.collectionView setContentOffset:CGPointMake(0, self.collectionViewLayout.collectionViewContentSize.height)]; + + if (self.collectionView.contentOffset.y <= 0) + [self.collectionView setContentOffset:CGPointMake(0, self.collectionViewLayout.collectionViewContentSize.height)]; } else { @@ -466,7 +468,7 @@ - (void)layoutTakePhotoOverlay - (void)takePhoto { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; - imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext; + imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen; imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage]; imagePickerController.delegate = self; @@ -489,9 +491,9 @@ - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error context * in case we are trying to dismiss the picker after taking a photo */ if ([self.picker.delegate respondsToSelector:@selector(assetsPickerController:didFinishTakingPhoto:)]) - [self.picker.delegate assetsPickerController:self.picker didFinishTakingPhoto:[self.assets firstObject]]; + [self.picker.delegate assetsPickerController:self.picker didFinishTakingPhoto:[self.assets lastObject]]; }]; -// self.imageCaptured = YES; + self.imageCaptured = YES; } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker diff --git a/CTAssetsPickerController/NSDateFormatter+timeIntervalFormatter.m b/CTAssetsPickerController/NSDateFormatter+timeIntervalFormatter.m index 25078f91..826b0aa6 100644 --- a/CTAssetsPickerController/NSDateFormatter+timeIntervalFormatter.m +++ b/CTAssetsPickerController/NSDateFormatter+timeIntervalFormatter.m @@ -52,17 +52,23 @@ - (NSString *)spellOutStringFromTimeInterval:(NSTimeInterval)timeInterval if (components.hour > 0) string = [string stringByAppendingFormat:@"%ld %@", (long)components.hour, - (components.hour > 1) ? NSLocalizedString(@"hours", nil) : NSLocalizedString(@"hour", nil)]; + (components.hour > 1) ? + NSLocalizedStringFromTable(@"hours", @"CTAssetsPickerController", nil) : + NSLocalizedStringFromTable(@"hour", @"CTAssetsPickerController", nil)]; if (components.minute > 0) string = [string stringByAppendingFormat:@"%ld %@", (long)components.minute, - (components.minute > 1) ? NSLocalizedString(@"minutes", nil) : NSLocalizedString(@"minute", nil)]; + (components.minute > 1) ? + NSLocalizedStringFromTable(@"minutes", @"CTAssetsPickerController", nil) : + NSLocalizedStringFromTable(@"minute", @"CTAssetsPickerController", nil)]; if (components.second > 0) string = [string stringByAppendingFormat:@"%ld %@", (long)components.second, - (components.second > 1) ? NSLocalizedString(@"seconds", nil) : NSLocalizedString(@"second", nil)]; + (components.second > 1) ? + NSLocalizedStringFromTable(@"seconds", @"CTAssetsPickerController", nil) : + NSLocalizedStringFromTable(@"second", @"CTAssetsPickerController", nil)]; return string; } diff --git a/CTAssetsPickerController/en.lproj/CTAssetsPickerController.strings b/CTAssetsPickerController/en.lproj/CTAssetsPickerController.strings new file mode 100644 index 00000000..5cf86d30 --- /dev/null +++ b/CTAssetsPickerController/en.lproj/CTAssetsPickerController.strings @@ -0,0 +1,48 @@ +/* Navigation bar buttons */ +"Cancel" = "Cancel"; +"Done" = "Done"; + +/* Default title */ +"Photos" = "Photos"; + +/* No. of selected */ +"%ld Photo Selected" = "%ld Photo Selected"; +"%ld Photos Selected" = "%ld Photos Selected"; +"%ld Video Selected" = "%ld Video Selected"; +"%ld Videos Selected" = "%ld Videos Selected"; +"%ld Items Selected" = "%ld Items Selected"; + +/* Album's footer */ +"%ld Photos" = "%ld Photos"; +"%ld Videos" = "%ld Videos"; +"%ld Photos, %ld Videos" = "%1$ld Photos, %2$ld Videos"; + +/* Assets index */ +"%ld of %ld" = "%1$ld of %2$ld"; + +/* Messages if privacy is not granted */ +"This app does not have access to your photos or videos." = "This app does not have access to your photos or videos."; +"You can enable access in Privacy Settings." = "You can enable access in Privacy Settings."; + +/* Messages if no assets */ +"No Photos or Videos" = "No Photos or Videos"; + +/* The parameter will be replaced by the device model name */ +"You can take photos and videos using the camera, or sync photos and videos onto your %@\nusing iTunes." = "You can take photos and videos using the camera, or sync photos and videos onto your %@\nusing iTunes."; +"You can sync photos and videos onto your iPhone using iTunes." = "You can sync photos and videos onto your iPhone using iTunes."; + +/* Accessibility labels */ +"Photo" = "Photo"; +"Video" = "Video"; +"Portrait" = "Portrait"; +"Landscape" = "Landscape"; +"Play" = "Play"; +"Not available" = "Not available"; + +/* Video duration spell out */ +"hours" = "hours"; +"hour" = "hour"; +"minutes" = "minutes"; +"minute" = "minute"; +"seconds" = "seconds"; +"second" = "second"; \ No newline at end of file diff --git a/CTAssetsPickerController/zh-Hant.lproj/CTAssetsPickerController.strings b/CTAssetsPickerController/zh-Hant.lproj/CTAssetsPickerController.strings new file mode 100644 index 00000000..3aeff26d --- /dev/null +++ b/CTAssetsPickerController/zh-Hant.lproj/CTAssetsPickerController.strings @@ -0,0 +1,48 @@ +/* Navigation bar buttons */ +"Cancel" = "取消"; +"Done" = "完成"; + +/* Default title */ +"Photos" = "照片"; + +/* No. of selected */ +"%ld Photo Selected" = "已選取 %ld 張照片"; +"%ld Photos Selected" = "已選取 %ld 張照片"; +"%ld Video Selected" = "已選取 %ld 部影片"; +"%ld Videos Selected" = "已選取 %ld 部影片"; +"%ld Items Selected" = "已選取 %ld 個項目"; + +/* Album's footer */ +"%ld Photos" = "%ld 張照片"; +"%ld Videos" = "%ld 部影片"; +"%ld Photos, %ld Videos" = "%1$ld 張照片、%2$ld 部影片"; + +/* Assets index */ +"%ld of %ld" = "%1$ld/%2$ld"; + +/* Messages if privacy is not granted */ +"This app does not have access to your photos or videos." = "此 App 無法取用您的照片或影片。"; +"You can enable access in Privacy Settings." = "您可以在「隱私權設定」中啟用存取。"; + +/* Messages if no assets */ +"No Photos or Videos" = "沒有照片或影片"; + +/* The parameter will be replaced by the device model name */ +"You can take photos and videos using the camera, or sync photos and videos onto your %@\nusing iTunes." = "您可以用相機拍照錄影或用 iTunes\n將照片和影片同步到 %@。"; +"You can sync photos and videos onto your %@ using iTunes." = "您可以使用 iTunes 將照片和影片\n同步到 %@。"; + +/* Accessibility labels */ +"Photo" = "照片"; +"Video" = "影片"; +"Portrait" = "直向"; +"Landscape" = "橫向"; +"Play" = "播放"; +"Not available" = "無法使用"; + +/* Video duration spell out */ +"hours" = "小時"; +"hour" = "小時"; +"minutes" = "分"; +"minute" = "分"; +"seconds" = "秒"; +"second" = "秒"; \ No newline at end of file diff --git a/CTAssetsPickerDemo.xcodeproj/project.pbxproj b/CTAssetsPickerDemo.xcodeproj/project.pbxproj index fb9fc9aa..cc2f6355 100644 --- a/CTAssetsPickerDemo.xcodeproj/project.pbxproj +++ b/CTAssetsPickerDemo.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ AD58799318E553FF00B5773D /* ALAsset+isEqual.m in Sources */ = {isa = PBXBuildFile; fileRef = AD58799218E553FF00B5773D /* ALAsset+isEqual.m */; }; AD58799618E5543500B5773D /* ALAssetsGroup+isEqual.m in Sources */ = {isa = PBXBuildFile; fileRef = AD58799518E5543500B5773D /* ALAssetsGroup+isEqual.m */; }; AD5C307C193EF4CE00D31C45 /* CTAssetsViewControllerTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = AD5C307B193EF4CE00D31C45 /* CTAssetsViewControllerTransition.m */; }; + AD68F6971A09FA5700097018 /* CTAssetsPickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD68F6991A09FA5700097018 /* CTAssetsPickerController.strings */; }; AD7D990F1978FE17002A2E4C /* CTAssetsPicker.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AD7D990E1978FE17002A2E4C /* CTAssetsPicker.xcassets */; }; ADBCACD718FF88FA002494D2 /* CTAssetsPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADBCACD618FF88FA002494D2 /* CTAssetsPageViewController.m */; }; ADDEA34B192F4A540049D6A7 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADDEA34A192F4A540049D6A7 /* MediaPlayer.framework */; }; @@ -45,39 +46,39 @@ ADE31DA017EFF08C008958B8 /* CTMasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADE31D9F17EFF08C008958B8 /* CTMasterViewController.m */; }; ADE31DA517EFF08C008958B8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADE31DA417EFF08C008958B8 /* Images.xcassets */; }; ADE31DC217EFF159008958B8 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADE31DC117EFF159008958B8 /* AssetsLibrary.framework */; }; - ADE31DDA17F12FB4008958B8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = ADE31DDC17F12FB4008958B8 /* Localizable.strings */; }; ADF20BD617F2737400E97692 /* CTAssetsPickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADF20BD217F2737300E97692 /* CTAssetsPickerController.m */; }; ADFDE19C19357D38004752B5 /* ALAsset+accessibilityLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = ADFDE19B19357D38004752B5 /* ALAsset+accessibilityLabel.m */; }; ADFDE1A21935857F004752B5 /* NSDateFormatter+timeIntervalFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = ADFDE1A11935857F004752B5 /* NSDateFormatter+timeIntervalFormatter.m */; }; - BE1B086A19EFBD39008C7103 /* NSMutableArray+Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = BE1B086919EFBD39008C7103 /* NSMutableArray+Utilities.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ AD309FC619E67B7500BFCE8B /* CTAssetsPickerCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsPickerCommon.h; sourceTree = ""; }; AD58798218E54F0C00B5773D /* CTAssetsGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsGroupViewController.h; sourceTree = ""; }; - AD58798318E54F0C00B5773D /* CTAssetsGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsGroupViewController.m; sourceTree = ""; }; + AD58798318E54F0C00B5773D /* CTAssetsGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetsGroupViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; AD58798518E550B000B5773D /* CTAssetsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsViewController.h; sourceTree = ""; }; - AD58798618E550B000B5773D /* CTAssetsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsViewController.m; sourceTree = ""; }; + AD58798618E550B000B5773D /* CTAssetsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetsViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; AD58798818E551E000B5773D /* CTAssetsGroupViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsGroupViewCell.h; sourceTree = ""; }; AD58798918E551E000B5773D /* CTAssetsGroupViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsGroupViewCell.m; sourceTree = ""; }; AD58798B18E552D700B5773D /* CTAssetsViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsViewCell.h; sourceTree = ""; }; AD58798C18E552D700B5773D /* CTAssetsViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsViewCell.m; sourceTree = ""; }; AD58798E18E5535400B5773D /* CTAssetsSupplementaryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsSupplementaryView.h; sourceTree = ""; }; - AD58798F18E5535400B5773D /* CTAssetsSupplementaryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsSupplementaryView.m; sourceTree = ""; }; + AD58798F18E5535400B5773D /* CTAssetsSupplementaryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetsSupplementaryView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; AD58799118E553FF00B5773D /* ALAsset+isEqual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ALAsset+isEqual.h"; sourceTree = ""; }; AD58799218E553FF00B5773D /* ALAsset+isEqual.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ALAsset+isEqual.m"; sourceTree = ""; }; AD58799418E5543500B5773D /* ALAssetsGroup+isEqual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ALAssetsGroup+isEqual.h"; sourceTree = ""; }; AD58799518E5543500B5773D /* ALAssetsGroup+isEqual.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ALAssetsGroup+isEqual.m"; sourceTree = ""; }; AD5C307A193EF4CE00D31C45 /* CTAssetsViewControllerTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsViewControllerTransition.h; sourceTree = ""; }; AD5C307B193EF4CE00D31C45 /* CTAssetsViewControllerTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsViewControllerTransition.m; sourceTree = ""; }; + AD68F6981A09FA5700097018 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/CTAssetsPickerController.strings; sourceTree = ""; }; + AD68F69A1A09FA6100097018 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/CTAssetsPickerController.strings"; sourceTree = ""; }; AD7D990E1978FE17002A2E4C /* CTAssetsPicker.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = CTAssetsPicker.xcassets; sourceTree = ""; }; ADBCACD518FF88FA002494D2 /* CTAssetsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetsPageViewController.h; sourceTree = ""; }; - ADBCACD618FF88FA002494D2 /* CTAssetsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetsPageViewController.m; sourceTree = ""; }; + ADBCACD618FF88FA002494D2 /* CTAssetsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetsPageViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; ADDEA34A192F4A540049D6A7 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; ADDEA34C192F4C590049D6A7 /* CTAssetItemViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetItemViewController.h; sourceTree = ""; }; ADDEA34D192F4C590049D6A7 /* CTAssetItemViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetItemViewController.m; sourceTree = ""; }; ADDEA34F192F4CB40049D6A7 /* CTAssetScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTAssetScrollView.h; sourceTree = ""; }; - ADDEA350192F4CB40049D6A7 /* CTAssetScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTAssetScrollView.m; sourceTree = ""; }; + ADDEA350192F4CB40049D6A7 /* CTAssetScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetScrollView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; ADDEA35219333BDA0049D6A7 /* ALAsset+assetType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ALAsset+assetType.h"; sourceTree = ""; }; ADDEA35319333BDA0049D6A7 /* ALAsset+assetType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ALAsset+assetType.m"; sourceTree = ""; }; ADE31D8617EFF08C008958B8 /* CTAssetsPickerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CTAssetsPickerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -92,19 +93,15 @@ ADE31D9917EFF08C008958B8 /* CTAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTAppDelegate.m; sourceTree = ""; }; ADE31D9C17EFF08C008958B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; ADE31D9E17EFF08C008958B8 /* CTMasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTMasterViewController.h; sourceTree = ""; }; - ADE31D9F17EFF08C008958B8 /* CTMasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTMasterViewController.m; sourceTree = ""; }; + ADE31D9F17EFF08C008958B8 /* CTMasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTMasterViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; ADE31DA417EFF08C008958B8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; ADE31DC117EFF159008958B8 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; - ADE31DDD17F13073008958B8 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; - ADE31DDF17F13084008958B8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; ADF20BD117F2737300E97692 /* CTAssetsPickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CTAssetsPickerController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; ADF20BD217F2737300E97692 /* CTAssetsPickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CTAssetsPickerController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; ADFDE19A19357D38004752B5 /* ALAsset+accessibilityLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ALAsset+accessibilityLabel.h"; sourceTree = ""; }; - ADFDE19B19357D38004752B5 /* ALAsset+accessibilityLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ALAsset+accessibilityLabel.m"; sourceTree = ""; }; + ADFDE19B19357D38004752B5 /* ALAsset+accessibilityLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "ALAsset+accessibilityLabel.m"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; ADFDE1A01935857F004752B5 /* NSDateFormatter+timeIntervalFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDateFormatter+timeIntervalFormatter.h"; sourceTree = ""; }; - ADFDE1A11935857F004752B5 /* NSDateFormatter+timeIntervalFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDateFormatter+timeIntervalFormatter.m"; sourceTree = ""; }; - BE1B086819EFBD39008C7103 /* NSMutableArray+Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+Utilities.h"; sourceTree = ""; }; - BE1B086919EFBD39008C7103 /* NSMutableArray+Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+Utilities.m"; sourceTree = ""; }; + ADFDE1A11935857F004752B5 /* NSDateFormatter+timeIntervalFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = "NSDateFormatter+timeIntervalFormatter.m"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -126,8 +123,6 @@ AD58799A18E5556700B5773D /* Categories */ = { isa = PBXGroup; children = ( - BE1B086819EFBD39008C7103 /* NSMutableArray+Utilities.h */, - BE1B086919EFBD39008C7103 /* NSMutableArray+Utilities.m */, AD58799118E553FF00B5773D /* ALAsset+isEqual.h */, AD58799218E553FF00B5773D /* ALAsset+isEqual.m */, ADFDE19A19357D38004752B5 /* ALAsset+accessibilityLabel.h */, @@ -181,7 +176,6 @@ ADE31D9E17EFF08C008958B8 /* CTMasterViewController.h */, ADE31D9F17EFF08C008958B8 /* CTMasterViewController.m */, ADE31DA417EFF08C008958B8 /* Images.xcassets */, - ADE31DDC17F12FB4008958B8 /* Localizable.strings */, ADE31D9017EFF08C008958B8 /* Supporting Files */, ); path = CTAssetsPickerDemo; @@ -224,6 +218,7 @@ AD309FC619E67B7500BFCE8B /* CTAssetsPickerCommon.h */, AD58799A18E5556700B5773D /* Categories */, AD7D990E1978FE17002A2E4C /* CTAssetsPicker.xcassets */, + AD68F6991A09FA5700097018 /* CTAssetsPickerController.strings */, ); path = CTAssetsPickerController; sourceTree = ""; @@ -255,7 +250,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = CT; - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0500; ORGANIZATIONNAME = "Clement T"; }; buildConfigurationList = ADE31D8117EFF08C008958B8 /* Build configuration list for PBXProject "CTAssetsPickerDemo" */; @@ -283,7 +278,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ADE31DDA17F12FB4008958B8 /* Localizable.strings in Resources */, + AD68F6971A09FA5700097018 /* CTAssetsPickerController.strings in Resources */, AD7D990F1978FE17002A2E4C /* CTAssetsPicker.xcassets in Resources */, ADE31DA517EFF08C008958B8 /* Images.xcassets in Resources */, ADE31D9417EFF08C008958B8 /* InfoPlist.strings in Resources */, @@ -318,7 +313,6 @@ AD58798418E54F0C00B5773D /* CTAssetsGroupViewController.m in Sources */, ADE31D9617EFF08C008958B8 /* main.m in Sources */, AD58799318E553FF00B5773D /* ALAsset+isEqual.m in Sources */, - BE1B086A19EFBD39008C7103 /* NSMutableArray+Utilities.m in Sources */, AD58798D18E552D700B5773D /* CTAssetsViewCell.m in Sources */, AD58798718E550B000B5773D /* CTAssetsViewController.m in Sources */, AD58799018E5535400B5773D /* CTAssetsSupplementaryView.m in Sources */, @@ -340,6 +334,15 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ + AD68F6991A09FA5700097018 /* CTAssetsPickerController.strings */ = { + isa = PBXVariantGroup; + children = ( + AD68F6981A09FA5700097018 /* en */, + AD68F69A1A09FA6100097018 /* zh-Hant */, + ); + name = CTAssetsPickerController.strings; + sourceTree = ""; + }; ADE31D9217EFF08C008958B8 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -356,15 +359,6 @@ name = Main.storyboard; sourceTree = ""; }; - ADE31DDC17F12FB4008958B8 /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - ADE31DDD17F13073008958B8 /* zh-Hant */, - ADE31DDF17F13084008958B8 /* en */, - ); - name = Localizable.strings; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -386,6 +380,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -424,6 +419,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; diff --git a/CTAssetsPickerDemo/CTMasterViewController.m b/CTAssetsPickerDemo/CTMasterViewController.m index dc149935..949ef72b 100644 --- a/CTAssetsPickerDemo/CTMasterViewController.m +++ b/CTAssetsPickerDemo/CTMasterViewController.m @@ -82,18 +82,11 @@ - (void)didReceiveMemoryWarning - (void)clearAssets:(id)sender { -// if (self.assets) -// { -// self.assets = nil; -// [self.tableView reloadData]; -// } - - UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; - imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext; - imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; - imagePickerController.delegate = self; - - [self presentViewController:imagePickerController animated:YES completion:NULL]; + if (self.assets) + { + self.assets = nil; + [self.tableView reloadData]; + } } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker diff --git a/CTAssetsPickerDemo/en.lproj/Localizable.strings b/CTAssetsPickerDemo/en.lproj/Localizable.strings deleted file mode 100644 index d1c4efcc..00000000 Binary files a/CTAssetsPickerDemo/en.lproj/Localizable.strings and /dev/null differ diff --git a/CTAssetsPickerDemo/zh-Hant.lproj/Localizable.strings b/CTAssetsPickerDemo/zh-Hant.lproj/Localizable.strings deleted file mode 100644 index 1f47c428..00000000 Binary files a/CTAssetsPickerDemo/zh-Hant.lproj/Localizable.strings and /dev/null differ diff --git a/README.md b/README.md index e6be2193..4e0535f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # CTAssetsPickerController -CTAssetsPickerController v2 released! It has newly re-design delegate methods, fixed serveral issues and improved usability. Please see [What's new](#whats-new) for the details. - ## Introduction CTAssetsPickerController is an iOS controller that allows picking multiple photos and videos from user's photo library. The usage and look-and-feel are just similar to UIImagePickerController. It uses **ARC**. Requires **AssetsLibrary** and **MediaPlayer** frameworks. @@ -14,17 +12,14 @@ CTAssetsPickerController is an iOS controller that allows picking multiple photo 3. Filters assets for picking only photos or videos. 4. Filters assets or albums by their properties. 5. Achieves average 5x fps. -6. Conforms UIAccessibility Protocol. -7. Support iPhone 6 and iPhone 6 Plus native view. +6. Conforms UIAppearance Protocol. +7. Conforms UIAccessibility Protocol. +8. Support iPhone 6 and iPhone 6 Plus native view. ## What's new * [Release Notes](RELEASE-NOTES.md) -#### Note -CTAssetsPickerController has dropped support for iOS 6. To use this control with iOS 6, you might consider to checkout the obsolete branch [1.x.x](https://github.com/chiunam/CTAssetsPickerController/tree/1.x.x), which developement has been ceased. - - ## Minimum Requirement Xcode 5 and iOS 7. @@ -35,7 +30,7 @@ Xcode 5 and iOS 7. ````bash $ edit Podfile platform :ios, '7.0' -pod 'CTAssetsPickerController', '~> 2.6.0' +pod 'CTAssetsPickerController', '~> 2.7.0' $ pod install ```` * Use the Xcode workspace instead of the project. @@ -68,16 +63,16 @@ picker.delegate = self; ### Implement didFinishPickingAssets delegate -The delegate is responsible for dismissing the picker when the operation completes. To dismiss the picker, call the [dismissViewControllerAnimated:completion:](https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/dismissViewControllerAnimated:completion:) method of the presenting controller responsible for displaying `CTAssetsPickerController` object. Please refer to the demo app. +The delegate is responsible for dismissing the picker when the operation completes. To dismiss the picker, call the [dismissViewControllerAnimated:completion:](https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/index.html#//apple_ref/occ/instm/UIViewController/dismissViewControllerAnimated:completion:) method of the presenting controller responsible for displaying `CTAssetsPickerController` object. Please refer to the demo app. ```` objective-c - (void)assetsPickerController:(CTAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets; // assets contains ALAsset objects. ```` -## Customization +## Customisation -Customization can be done by setting properties or implementating delegate methods. This section describes common customizations. Please refer to the [documentation](#documentation) for the complete list of properties and delegate methods. +Customisation can be done by setting properties or implementating delegate methods. This section describes common customisations. Please refer to the [documentation](#documentation) for the complete list of properties and delegate methods. ### Properties @@ -162,11 +157,11 @@ Enable only certain assets to be selected. **Default album** -You can show an album content (e.g. Camera Roll) initially instead of a list of albums by implementing the following delegate method. The default album must not returns `NO` in `shouldShowAssetsGroup`. +You can show an album content (e.g. All Photos) initially instead of a list of albums by implementing the following delegate method. The default album must not returns `NO` in `shouldShowAssetsGroup`. ```` objective-c - (BOOL)assetsPickerController:(CTAssetsPickerController *)picker isDefaultAssetsGroup:(ALAssetsGroup *)group { - // Set Camera Roll as default album and it will be shown initially. + // Set All Photos as default album and it will be shown initially. return ([[group valueForProperty:ALAssetsGroupPropertyType] integerValue] == ALAssetsGroupSavedPhotos); } ```` @@ -209,6 +204,9 @@ Assets stored on iCloud may not be displayed and picked properly if they have no ### Apperance +The picker conforms `UIAppearance` protocol. For most UI appearance, (e.g. fonts, buttons, text colors), it can be overridden by setting proper `UIAppearance` after picker initalisation. Please refer to [UIAppearance Protocol Reference]( https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAppearance_Protocol/index.html#//apple_ref/occ/intfcm/UIAppearance/appearance) + + The first child view controller of the picker is a `UINavigationController`. You can access the navigation controller via the property `childNavigationController` and then customise its apperance. ```` objective-c @@ -235,8 +233,21 @@ You may also create custom `UINavigationController` subclass if you want to cont ```` +The appearance of footer text requires overridden by using `appearanceWhenContainedIn:`. + +```` objective-c +//Set appearance of footer text +UIBarButtonItem *barButtonItem = [UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], [CTAssetsPickerController class], nil]; +[barButtonItem setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName: [UIColor redColor]} forState:UIControlStateNormal]; +``` + +### Localisation + +`CTAssetsPickerController.strings` contains strings used in the picker. It will be included if you add the picker to your project by installing via [submodules](#via-git-submodules). You might translate the text accordingly. PR is always welcomed if you add translation of the picker. + +If you uses [CocoaPods](#via-cocoapods), please download the [string table](https://github.com/chiunam/CTAssetsPickerController/blob/master/CTAssetsPickerController/en.lproj/CTAssetsPickerController.strings) and add it to project manually. -### Notifications +## Notifications An `NSNotification` object named `CTAssetsPickerSelectedAssetsChangedNotification` will be sent when user select or deselect assets. You may add your observer to monitor the change of selection. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f895c514..02a7d90e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,11 @@ +### v2.7.0 +* [#57](https://github.com/chiunam/CTAssetsPickerController/issues/57) Make the picker's toolbar to conform UIApperance so that it can be overridden +* [#56](https://github.com/chiunam/CTAssetsPickerController/issues/56) Move the localisable string to separated string table + + +### v2.6.1 +* [#55](https://github.com/chiunam/CTAssetsPickerController/issues/55) Fix: Pictures disappear until you do scrolling gesture when you take screenshot + ### v2.6.0 * Fix: Footer of collection view is not horizontally centered in iOS 8 * Add: Support iPhone 6 and iPhone 6 Plus native view diff --git a/Screenshot.png b/Screenshot.png index 2229d6b5..79520ea7 100644 Binary files a/Screenshot.png and b/Screenshot.png differ