Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Darling authored and Darling committed Sep 28, 2019
1 parent bc881e9 commit eb497e3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 18 deletions.
1 change: 1 addition & 0 deletions DLPhotoPicker/Controller/DLPhotoPickerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef NS_ENUM(NSInteger, DLPhotoPickerType) {
* set this property’s value to `NO`.
*/
@property (nonatomic, assign) BOOL showsCancelButton;
@property (nonatomic, assign) BOOL showsLeftCancelButton;

/**
* Determines whether or not the empty albums is shown in the album list.
Expand Down
2 changes: 2 additions & 0 deletions DLPhotoPicker/Controller/DLPhotoPickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ - (void)dealloc
- (void)setupInit
{
_showsNumberOfAssets = YES;
_showsLeftCancelButton = NO;
_showsCancelButton = YES;
_hidesBottomBarWhenPushedInAssetView = YES;
_selectedAssets = [@[] mutableCopy];
Expand Down Expand Up @@ -196,6 +197,7 @@ - (void)replaceObjectInSelectedAssetsAtIndex:(NSUInteger)index withObject:(DLPho
- (void)getAlbumsSuccess
{
DLPhotoTableViewController *albumTableViewController = [[DLPhotoTableViewController alloc] init];
albumTableViewController.showsLeftCancelButton = self.showsLeftCancelButton;
albumTableViewController.navigationItem.title = self.navigationTitle;;

[self pushViewController:albumTableViewController animated:NO];
Expand Down
2 changes: 2 additions & 0 deletions DLPhotoPicker/Controller/DLPhotoTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
*/
@property (nonatomic, strong) NSMutableArray *photoCollections;

@property (nonatomic, assign) BOOL showsLeftCancelButton;

@end
41 changes: 32 additions & 9 deletions DLPhotoPicker/Controller/DLPhotoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,33 @@ - (void)setupButtons
target:self
action:@selector(clickCancelSelectAction:)];
}else if (self.picker.pickerType == DLPhotoPickerTypeDisplay){
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(clickAddAlbumAction:)];

self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self
action:@selector(clickEditAlbumAction:)];
if (self.showsLeftCancelButton) {
UIBarButtonItem *add =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(clickAddAlbumAction:)];

UIBarButtonItem *edit =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self
action:@selector(clickEditAlbumAction:)];
self.navigationItem.rightBarButtonItems = @[add, edit];

self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(clickLeftCancelAction:)];
}else {
self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(clickAddAlbumAction:)];

self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self
action:@selector(clickEditAlbumAction:)];
}
}else{
}
}
Expand Down Expand Up @@ -288,6 +306,11 @@ - (void)replaceObjectInPhotoCollectionsAtIndex:(NSUInteger)index withObject:(DLP
}

#pragma mark - Button Action
-(void)clickLeftCancelAction:(UIBarButtonItem *)sender
{
[self.picker dismissViewControllerAnimated:YES completion:nil];
}

-(void)clickCancelSelectAction:(UIBarButtonItem *)sender
{
if ([self.picker.delegate respondsToSelector:@selector(pickerControllerDidCancel:)]){
Expand Down
19 changes: 10 additions & 9 deletions DLPhotoPickerDemo/DLPhotoPickerDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
TargetAttributes = {
595178AC1C7C225D00000BDE = {
CreatedOnToolsVersion = 7.2.1;
DevelopmentTeam = 93XLKGTF68;
DevelopmentTeam = ET492SNZM9;
};
5977D9831C93BEFD005C0A4B = {
CreatedOnToolsVersion = 7.2.1;
Expand All @@ -526,6 +526,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
ar,
Expand Down Expand Up @@ -597,7 +598,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-DLPhotoPickerDemo/Pods-DLPhotoPickerDemo-resources.sh",
"${PODS_ROOT}/Target Support Files/Pods-DLPhotoPickerDemo/Pods-DLPhotoPickerDemo-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/DLPhotoPicker/DLPhotoPicker.bundle",
"${PODS_ROOT}/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/TOCropViewController/TOCropViewControllerBundle.bundle",
Expand All @@ -610,7 +611,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DLPhotoPickerDemo/Pods-DLPhotoPickerDemo-resources.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DLPhotoPickerDemo/Pods-DLPhotoPickerDemo-resources.sh\"\n";
showEnvVarsInLog = 0;
};
85D129996BA5FBFC5B00856F /* [CP] Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -762,7 +763,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -809,7 +810,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -823,11 +824,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
DEVELOPMENT_TEAM = 93XLKGTF68;
DEVELOPMENT_TEAM = ET492SNZM9;
INFOPLIST_FILE = DLPhotoPickerDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.darlingcoder.DLPhotoPickerDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.lz.DLPhotoPickerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -838,11 +839,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
DEVELOPMENT_TEAM = 93XLKGTF68;
DEVELOPMENT_TEAM = ET492SNZM9;
INFOPLIST_FILE = DLPhotoPickerDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.darlingcoder.DLPhotoPickerDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.lz.DLPhotoPickerDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down
1 change: 1 addition & 0 deletions DLPhotoPickerDemo/DLPhotoPickerDemo/PhotoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ - (void)didReceiveMemoryWarning {
- (IBAction)clickPhotoDisplayAction:(id)sender {
DLPhotoPickerViewController *picker = [[DLPhotoPickerViewController alloc] init];
picker.delegate = self;
picker.showsLeftCancelButton = YES;
picker.showsNumberOfAssets = YES;
picker.navigationTitle = NSLocalizedString(@"Albums", nil);
picker.pickerType = DLPhotoPickerTypeDisplay;
Expand Down

0 comments on commit eb497e3

Please sign in to comment.