From f221540b29803bfc0017e84532059eb4ec6f1417 Mon Sep 17 00:00:00 2001 From: Tsyganov Stanislav Date: Sat, 1 Oct 2016 17:20:37 +0300 Subject: [PATCH] Added rightBarItemForAlbumsController property. --- CTAssetsPickerController/CTAssetCollectionViewController.m | 4 ++-- CTAssetsPickerController/CTAssetsPickerController.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CTAssetsPickerController/CTAssetCollectionViewController.m b/CTAssetsPickerController/CTAssetCollectionViewController.m index 0daf3c61..2b04b8bd 100644 --- a/CTAssetsPickerController/CTAssetCollectionViewController.m +++ b/CTAssetsPickerController/CTAssetCollectionViewController.m @@ -344,12 +344,12 @@ - (void)updateTitle:(NSArray *)selectedAssets - (void)updateButton:(NSArray *)selectedAssets { self.navigationItem.leftBarButtonItem = (self.picker.showsCancelButton) ? self.cancelButton : nil; - self.navigationItem.rightBarButtonItem = [self isTopViewController] ? self.doneButton : nil; + self.navigationItem.rightBarButtonItem = [self isTopViewController] ? self.doneButton : self.picker.rightBarItemForAlbumsController; if (self.picker.alwaysEnableDoneButton) self.navigationItem.rightBarButtonItem.enabled = YES; else - self.navigationItem.rightBarButtonItem.enabled = (self.picker.selectedAssets.count > 0); + self.navigationItem.rightBarButtonItem.enabled = (self.picker.selectedAssets.count > 0) || ![self isTopViewController]; } - (BOOL)isTopViewController diff --git a/CTAssetsPickerController/CTAssetsPickerController.h b/CTAssetsPickerController/CTAssetsPickerController.h index 0afa620e..edd69ebd 100644 --- a/CTAssetsPickerController/CTAssetsPickerController.h +++ b/CTAssetsPickerController/CTAssetsPickerController.h @@ -93,6 +93,13 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, copy) NSString *doneButtonTitle; +/** + * A right bar button item for album controller + * + * It can be usefull to add the item button with camera style for example. + */ +@property (nonatomic, strong) UIBarButtonItem *rightBarItemForAlbumsController; + /** * Determines whether or not the cancel button is visible in the picker. *