Commit 924b759c authored by 杨炯's avatar 杨炯

添加导航栏返回按钮的自定义

parent fb7c1e02
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
90CE84AE1C3A89EF003D0779 /* TZImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 90CE84AD1C3A89EF003D0779 /* TZImageManager.m */; }; 90CE84AE1C3A89EF003D0779 /* TZImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 90CE84AD1C3A89EF003D0779 /* TZImageManager.m */; };
90CE84B71C3BABB6003D0779 /* TZVideoPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90CE84B61C3BABB6003D0779 /* TZVideoPlayerController.m */; }; 90CE84B71C3BABB6003D0779 /* TZVideoPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 90CE84B61C3BABB6003D0779 /* TZVideoPlayerController.m */; };
90EBF5D61C2E298000CB9BCC /* UIView+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 90EBF5D51C2E298000CB9BCC /* UIView+Layout.m */; }; 90EBF5D61C2E298000CB9BCC /* UIView+Layout.m in Sources */ = {isa = PBXBuildFile; fileRef = 90EBF5D51C2E298000CB9BCC /* UIView+Layout.m */; };
939868A71F56C2AC00D03E64 /* TZLeftBarButtonModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 939868A61F56C2AC00D03E64 /* TZLeftBarButtonModel.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -107,6 +108,8 @@ ...@@ -107,6 +108,8 @@
90CE84B61C3BABB6003D0779 /* TZVideoPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TZVideoPlayerController.m; sourceTree = "<group>"; }; 90CE84B61C3BABB6003D0779 /* TZVideoPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TZVideoPlayerController.m; sourceTree = "<group>"; };
90EBF5D41C2E298000CB9BCC /* UIView+Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Layout.h"; sourceTree = "<group>"; }; 90EBF5D41C2E298000CB9BCC /* UIView+Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Layout.h"; sourceTree = "<group>"; };
90EBF5D51C2E298000CB9BCC /* UIView+Layout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Layout.m"; sourceTree = "<group>"; }; 90EBF5D51C2E298000CB9BCC /* UIView+Layout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Layout.m"; sourceTree = "<group>"; };
939868A51F56C2AC00D03E64 /* TZLeftBarButtonModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TZLeftBarButtonModel.h; sourceTree = "<group>"; };
939868A61F56C2AC00D03E64 /* TZLeftBarButtonModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TZLeftBarButtonModel.m; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -219,6 +222,8 @@ ...@@ -219,6 +222,8 @@
900EEFF71C2BBF9500EA709B /* TZImagePickerController.m */, 900EEFF71C2BBF9500EA709B /* TZImagePickerController.m */,
900EEFFC1C2BD58B00EA709B /* TZPhotoPickerController.h */, 900EEFFC1C2BD58B00EA709B /* TZPhotoPickerController.h */,
900EEFFD1C2BD58B00EA709B /* TZPhotoPickerController.m */, 900EEFFD1C2BD58B00EA709B /* TZPhotoPickerController.m */,
939868A51F56C2AC00D03E64 /* TZLeftBarButtonModel.h */,
939868A61F56C2AC00D03E64 /* TZLeftBarButtonModel.m */,
900EEFFF1C2BD7E400EA709B /* TZAssetCell.h */, 900EEFFF1C2BD7E400EA709B /* TZAssetCell.h */,
900EF0001C2BD7E400EA709B /* TZAssetCell.m */, 900EF0001C2BD7E400EA709B /* TZAssetCell.m */,
900EF00D1C2C0B1100EA709B /* TZAssetModel.h */, 900EF00D1C2C0B1100EA709B /* TZAssetModel.h */,
...@@ -324,7 +329,7 @@ ...@@ -324,7 +329,7 @@
TargetAttributes = { TargetAttributes = {
900E657B1C2BB8D5003D9A9E = { 900E657B1C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
DevelopmentTeam = T86X98NCU2; DevelopmentTeam = 3Q6ZMMAKC2;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
900E65941C2BB8D5003D9A9E = { 900E65941C2BB8D5003D9A9E = {
...@@ -406,6 +411,7 @@ ...@@ -406,6 +411,7 @@
900E65811C2BB8D5003D9A9E /* main.m in Sources */, 900E65811C2BB8D5003D9A9E /* main.m in Sources */,
900EF0121C2C107400EA709B /* TZPhotoPreviewController.m in Sources */, 900EF0121C2C107400EA709B /* TZPhotoPreviewController.m in Sources */,
6D5358CD1D64600F00928CC6 /* NSBundle+TZImagePicker.m in Sources */, 6D5358CD1D64600F00928CC6 /* NSBundle+TZImagePicker.m in Sources */,
939868A71F56C2AC00D03E64 /* TZLeftBarButtonModel.m in Sources */,
900EEFF81C2BBF9500EA709B /* TZImagePickerController.m in Sources */, 900EEFF81C2BBF9500EA709B /* TZImagePickerController.m in Sources */,
902938D81EE2D02C000F2F8F /* TZLocationManager.m in Sources */, 902938D81EE2D02C000F2F8F /* TZLocationManager.m in Sources */,
6DC84D0A1DF5358500A107A9 /* TZImageCropManager.m in Sources */, 6DC84D0A1DF5358500A107A9 /* TZImageCropManager.m in Sources */,
...@@ -551,7 +557,7 @@ ...@@ -551,7 +557,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 +578,7 @@ ...@@ -572,7 +578,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 (^navLeftBarButtonBlick)(UIButton *leftButton); ///< 自定义返回按钮样式及其属性
- (id)showAlertWithTitle:(NSString *)title; - (id)showAlertWithTitle:(NSString *)title;
- (void)hideAlertView:(id)alertView; - (void)hideAlertView:(id)alertView;
- (void)showProgressHUD; - (void)showProgressHUD;
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
_naviBgColor = naviBgColor; _naviBgColor = naviBgColor;
self.navigationBar.barTintColor = naviBgColor; self.navigationBar.barTintColor = naviBgColor;
} }
-(void)setBackBarItemColor:(UIColor *)backBarItemColor{
}
- (void)setNaviTitleColor:(UIColor *)naviTitleColor { - (void)setNaviTitleColor:(UIColor *)naviTitleColor {
_naviTitleColor = naviTitleColor; _naviTitleColor = naviTitleColor;
[self configNaviTitleAppearance]; [self configNaviTitleAppearance];
......
//
// TZLeftBarButtonModel.h
// TZImagePickerController
//
// Created by 杨炯 on 2017/8/30.
// Copyright © 2017年 谭真. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface TZLeftBarButtonModel : NSObject
/**导航栏左边按钮标题*/
@property(nonatomic,strong)NSString *leftBarButtonTitle;
/**导航栏左边按钮图片*/
@property(nonatomic,strong)UIImage *leftBarButtonImage;
@end
//
// TZLeftBarButtonModel.m
// TZImagePickerController
//
// Created by 杨炯 on 2017/8/30.
// Copyright © 2017年 谭真. All rights reserved.
//
#import "TZLeftBarButtonModel.h"
@implementation TZLeftBarButtonModel
@end
...@@ -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
......
...@@ -78,6 +78,13 @@ static CGFloat itemMargin = 5; ...@@ -78,6 +78,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.navLeftBarButtonBlick) {
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
leftButton.frame = CGRectMake(0, 0, 40, 40);
[leftButton addTarget:self action:@selector(goBackEvent:) forControlEvents:UIControlEventTouchUpInside];
tzImagePickerVc.navLeftBarButtonBlick(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 +321,9 @@ static CGFloat itemMargin = 5; ...@@ -314,7 +321,9 @@ static CGFloat itemMargin = 5;
} }
#pragma mark - Click Event #pragma mark - Click Event
-(void)goBackEvent:(UIButton *)backButton{
[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 setNavLeftBarButtonBlick:^(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