Commit 16ad2a10 authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #564 from yJion/master

支持定制导航栏返回按钮样式
parents fb7c1e02 59ef8320
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
TargetAttributes = { TargetAttributes = {
900E657B1C2BB8D5003D9A9E = { 900E657B1C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
DevelopmentTeam = T86X98NCU2; DevelopmentTeam = 3Q6ZMMAKC2;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
900E65941C2BB8D5003D9A9E = { 900E65941C2BB8D5003D9A9E = {
...@@ -551,7 +551,7 @@ ...@@ -551,7 +551,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = T86X98NCU2; DEVELOPMENT_TEAM = 3Q6ZMMAKC2;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
...@@ -572,7 +572,7 @@ ...@@ -572,7 +572,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = T86X98NCU2; DEVELOPMENT_TEAM = 3Q6ZMMAKC2;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "back@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -119,6 +119,8 @@ ...@@ -119,6 +119,8 @@
@property (nonatomic, assign) NSInteger circleCropRadius; ///< 圆形裁剪框半径大小 @property (nonatomic, assign) NSInteger circleCropRadius; ///< 圆形裁剪框半径大小
@property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView); ///< 自定义裁剪框的其他属性 @property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView); ///< 自定义裁剪框的其他属性
@property (nonatomic, copy) void (^navLeftBarButtonBlock)(UIButton *leftButton); ///< 自定义返回按钮样式及其属性
- (id)showAlertWithTitle:(NSString *)title; - (id)showAlertWithTitle:(NSString *)title;
- (void)hideAlertView:(id)alertView; - (void)hideAlertView:(id)alertView;
- (void)showProgressHUD; - (void)showProgressHUD;
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
@property (nonatomic, assign) BOOL isFirstAppear; @property (nonatomic, assign) BOOL isFirstAppear;
@property (nonatomic, assign) NSInteger columnNumber; @property (nonatomic, assign) NSInteger columnNumber;
@property (nonatomic, strong) TZAlbumModel *model; @property (nonatomic, strong) TZAlbumModel *model;
@end @end
......
...@@ -69,7 +69,6 @@ static CGFloat itemMargin = 5; ...@@ -69,7 +69,6 @@ static CGFloat itemMargin = 5;
} }
return _imagePickerVc; return _imagePickerVc;
} }
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
...@@ -78,6 +77,13 @@ static CGFloat itemMargin = 5; ...@@ -78,6 +77,13 @@ static CGFloat itemMargin = 5;
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = _model.name; self.navigationItem.title = _model.name;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:tzImagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:tzImagePickerVc action:@selector(cancelButtonClick)]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:tzImagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:tzImagePickerVc action:@selector(cancelButtonClick)];
if (tzImagePickerVc.navLeftBarButtonBlock) {
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
leftButton.frame = CGRectMake(0, 0, 40, 40);
[leftButton addTarget:self action:@selector(navLeftBarButtonClick) forControlEvents:UIControlEventTouchUpInside];
tzImagePickerVc.navLeftBarButtonBlock(leftButton);
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftButton];
}
_showTakePhotoBtn = (([[TZImageManager manager] isCameraRollAlbum:_model.name]) && tzImagePickerVc.allowTakePicture); _showTakePhotoBtn = (([[TZImageManager manager] isCameraRollAlbum:_model.name]) && tzImagePickerVc.allowTakePicture);
// [self resetCachedAssets]; // [self resetCachedAssets];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
...@@ -314,7 +320,9 @@ static CGFloat itemMargin = 5; ...@@ -314,7 +320,9 @@ static CGFloat itemMargin = 5;
} }
#pragma mark - Click Event #pragma mark - Click Event
-(void)navLeftBarButtonClick{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)previewButtonClick { - (void)previewButtonClick {
TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init]; TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
[self pushPhotoPrevireViewController:photoPreviewVc]; [self pushPhotoPrevireViewController:photoPreviewVc];
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
} }
NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal]; NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal];
[BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal]; [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];
} }
return _imagePickerVc; return _imagePickerVc;
} }
...@@ -276,7 +277,11 @@ ...@@ -276,7 +277,11 @@
}];*/ }];*/
//imagePickerVc.allowPreview = NO; //imagePickerVc.allowPreview = NO;
// 自定义导航栏上的返回按钮
[imagePickerVc setNavLeftBarButtonBlock:^(UIButton *leftButton){
[leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
[leftButton setImageEdgeInsets:UIEdgeInsetsMake(0, -20, 0, 20)];
}];
imagePickerVc.isStatusBarDefault = NO; imagePickerVc.isStatusBarDefault = NO;
#pragma mark - 到这里为止 #pragma mark - 到这里为止
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment