Commit 55f0f42c authored by banchichen's avatar banchichen

允许更改按钮的文字

parent 3d2d8760
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
@property (nonatomic, assign) BOOL allowCrop; ///< 允许裁剪,默认为YES,showSelectBtn为NO才生效 @property (nonatomic, assign) BOOL allowCrop; ///< 允许裁剪,默认为YES,showSelectBtn为NO才生效
@property (nonatomic, assign) CGRect cropRect; ///< 裁剪框的尺寸 @property (nonatomic, assign) CGRect cropRect; ///< 裁剪框的尺寸
@property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView); ///< 自定义裁剪框的其他属性 @property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView); ///< 自定义裁剪框的其他属性
@property (nonatomic, copy) void (^cropBgViewSettingBlock)(UIView *cropBgView); ///< 自定义裁剪框背景的其他属性
- (void)showAlertWithTitle:(NSString *)title; - (void)showAlertWithTitle:(NSString *)title;
- (void)showProgressHUD; - (void)showProgressHUD;
...@@ -112,12 +113,19 @@ ...@@ -112,12 +113,19 @@
@property (nonatomic, copy) NSString *photoPreviewOriginDefImageName; @property (nonatomic, copy) NSString *photoPreviewOriginDefImageName;
@property (nonatomic, copy) NSString *photoNumberIconImageName; @property (nonatomic, copy) NSString *photoNumberIconImageName;
/// Appearance / 外观颜色 /// Appearance / 外观颜色 + 按钮文字
@property (nonatomic, strong) UIColor *oKButtonTitleColorNormal; @property (nonatomic, strong) UIColor *oKButtonTitleColorNormal;
@property (nonatomic, strong) UIColor *oKButtonTitleColorDisabled; @property (nonatomic, strong) UIColor *oKButtonTitleColorDisabled;
@property (nonatomic, strong) UIColor *barItemTextColor; @property (nonatomic, strong) UIColor *barItemTextColor;
@property (nonatomic, strong) UIFont *barItemTextFont; @property (nonatomic, strong) UIFont *barItemTextFont;
@property (nonatomic, copy) NSString *doneBtnTitleStr;
@property (nonatomic, copy) NSString *cancelBtnTitleStr;
@property (nonatomic, copy) NSString *previewBtnTitleStr;
@property (nonatomic, copy) NSString *fullImageBtnTitleStr;
@property (nonatomic, copy) NSString *settingBtnTitleStr;
@property (nonatomic, copy) NSString *processHintStr;
// The picker should dismiss itself; when it dismissed these handle will be called. // The picker should dismiss itself; when it dismissed these handle will be called.
// You can also set autoDismiss to NO, then the picker don't dismiss itself. // You can also set autoDismiss to NO, then the picker don't dismiss itself.
// If isOriginalPhoto is YES, user picked the original photo. // If isOriginalPhoto is YES, user picked the original photo.
......
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
self.barItemTextColor = [UIColor whiteColor]; self.barItemTextColor = [UIColor whiteColor];
self.columnNumber = columnNumber; self.columnNumber = columnNumber;
[self configDefaultImageName]; [self configDefaultImageName];
[self configDefaultBtnTitle];
if (![[TZImageManager manager] authorizationStatusAuthorized]) { if (![[TZImageManager manager] authorizationStatusAuthorized]) {
_tipLable = [[UILabel alloc] init]; _tipLable = [[UILabel alloc] init];
...@@ -143,7 +144,7 @@ ...@@ -143,7 +144,7 @@
[self.view addSubview:_tipLable]; [self.view addSubview:_tipLable];
_settingBtn = [UIButton buttonWithType:UIButtonTypeSystem]; _settingBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[_settingBtn setTitle:[NSBundle tz_localizedStringForKey:@"Setting"] forState:UIControlStateNormal]; [_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal];
_settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44); _settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44);
_settingBtn.titleLabel.font = [UIFont systemFontOfSize:18]; _settingBtn.titleLabel.font = [UIFont systemFontOfSize:18];
[_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside]; [_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside];
...@@ -170,6 +171,7 @@ ...@@ -170,6 +171,7 @@
self.barItemTextFont = [UIFont systemFontOfSize:15]; self.barItemTextFont = [UIFont systemFontOfSize:15];
self.barItemTextColor = [UIColor whiteColor]; self.barItemTextColor = [UIColor whiteColor];
[self configDefaultImageName]; [self configDefaultImageName];
[self configDefaultBtnTitle];
previewVc.photos = [NSMutableArray arrayWithArray:selectedPhotos]; previewVc.photos = [NSMutableArray arrayWithArray:selectedPhotos];
previewVc.currentIndex = index; previewVc.currentIndex = index;
...@@ -194,6 +196,15 @@ ...@@ -194,6 +196,15 @@
self.photoOriginSelImageName = @"photo_original_sel.png"; self.photoOriginSelImageName = @"photo_original_sel.png";
} }
- (void)configDefaultBtnTitle {
self.doneBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Done"];
self.cancelBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Cancel"];
self.previewBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Preview"];
self.fullImageBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Full image"];
self.settingBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Setting"];
self.processHintStr = [NSBundle tz_localizedStringForKey:@"Processing..."];
}
- (void)observeAuthrizationStatusChange { - (void)observeAuthrizationStatusChange {
if ([[TZImageManager manager] authorizationStatusAuthorized]) { if ([[TZImageManager manager] authorizationStatusAuthorized]) {
[_tipLable removeFromSuperview]; [_tipLable removeFromSuperview];
...@@ -250,7 +261,7 @@ ...@@ -250,7 +261,7 @@
_HUDLable = [[UILabel alloc] init]; _HUDLable = [[UILabel alloc] init];
_HUDLable.frame = CGRectMake(0,40, 120, 50); _HUDLable.frame = CGRectMake(0,40, 120, 50);
_HUDLable.textAlignment = NSTextAlignmentCenter; _HUDLable.textAlignment = NSTextAlignmentCenter;
_HUDLable.text = @"正在处理..."; _HUDLable.text = self.processHintStr;
_HUDLable.font = [UIFont systemFontOfSize:15]; _HUDLable.font = [UIFont systemFontOfSize:15];
_HUDLable.textColor = [UIColor whiteColor]; _HUDLable.textColor = [UIColor whiteColor];
...@@ -421,7 +432,8 @@ ...@@ -421,7 +432,8 @@
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Photos"]; self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Photos"];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Cancel"] style:UIBarButtonItemStylePlain target:self action:@selector(cancel)]; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:imagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
[self configTableView]; [self configTableView];
// 1.6.10 采用微信的方式,只在相册列表页定义backBarButtonItem为返回,其余的顺系统的做法 // 1.6.10 采用微信的方式,只在相册列表页定义backBarButtonItem为返回,其余的顺系统的做法
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
UIButton *_selectButton; UIButton *_selectButton;
UIView *_toolBar; UIView *_toolBar;
UIButton *_okButton; UIButton *_doneButton;
UIImageView *_numberImageView; UIImageView *_numberImageView;
UILabel *_numberLable; UILabel *_numberLable;
UIButton *_originalPhotoButton; UIButton *_originalPhotoButton;
...@@ -107,16 +107,15 @@ ...@@ -107,16 +107,15 @@
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (_tzImagePickerVc.allowPickingOriginalPhoto) { if (_tzImagePickerVc.allowPickingOriginalPhoto) {
NSString *fullImageText = [NSBundle tz_localizedStringForKey:@"Full image"]; CGFloat fullImageWidth = [_tzImagePickerVc.fullImageBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;
CGFloat fullImageWidth = [fullImageText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;
_originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom]; _originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
_originalPhotoButton.frame = CGRectMake(0, 0, fullImageWidth + 56, 44); _originalPhotoButton.frame = CGRectMake(0, 0, fullImageWidth + 56, 44);
_originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0); _originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
_originalPhotoButton.backgroundColor = [UIColor clearColor]; _originalPhotoButton.backgroundColor = [UIColor clearColor];
[_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];
_originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:13]; _originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:13];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateNormal]; [_originalPhotoButton setTitle:_tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];
[_originalPhotoButton setTitle:fullImageText forState:UIControlStateSelected]; [_originalPhotoButton setTitle:_tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];
[_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal]; [_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
[_originalPhotoButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected]; [_originalPhotoButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoPreviewOriginDefImageName] forState:UIControlStateNormal]; [_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoPreviewOriginDefImageName] forState:UIControlStateNormal];
...@@ -131,12 +130,12 @@ ...@@ -131,12 +130,12 @@
if (_isSelectOriginalPhoto) [self showPhotoBytes]; if (_isSelectOriginalPhoto) [self showPhotoBytes];
} }
_okButton = [UIButton buttonWithType:UIButtonTypeCustom]; _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
_okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44); _doneButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44);
_okButton.titleLabel.font = [UIFont systemFontOfSize:16]; _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_okButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal]; [_doneButton setTitle:_tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
[_okButton setTitleColor:_tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal]; [_doneButton setTitleColor:_tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
_numberImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoNumberIconImageName]]; _numberImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoNumberIconImageName]];
_numberImageView.backgroundColor = [UIColor clearColor]; _numberImageView.backgroundColor = [UIColor clearColor];
...@@ -153,7 +152,7 @@ ...@@ -153,7 +152,7 @@
_numberLable.backgroundColor = [UIColor clearColor]; _numberLable.backgroundColor = [UIColor clearColor];
[_originalPhotoButton addSubview:_originalPhotoLable]; [_originalPhotoButton addSubview:_originalPhotoLable];
[_toolBar addSubview:_okButton]; [_toolBar addSubview:_doneButton];
[_toolBar addSubview:_originalPhotoButton]; [_toolBar addSubview:_originalPhotoButton];
[_toolBar addSubview:_numberImageView]; [_toolBar addSubview:_numberImageView];
[_toolBar addSubview:_numberLable]; [_toolBar addSubview:_numberLable];
...@@ -189,6 +188,9 @@ ...@@ -189,6 +188,9 @@
_cropBgView.alpha = 0.5; _cropBgView.alpha = 0.5;
_cropBgView.frame = self.view.bounds; _cropBgView.frame = self.view.bounds;
[self.view addSubview:_cropBgView]; [self.view addSubview:_cropBgView];
if (_tzImagePickerVc.cropBgViewSettingBlock) {
_tzImagePickerVc.cropBgViewSettingBlock(_cropBgView);
}
[TZImageCropManager overlayClippingWithView:_cropBgView cropRect:_tzImagePickerVc.cropRect containerView:self.view]; [TZImageCropManager overlayClippingWithView:_cropBgView cropRect:_tzImagePickerVc.cropRect containerView:self.view];
_cropView = [UIView new]; _cropView = [UIView new];
...@@ -397,7 +399,7 @@ ...@@ -397,7 +399,7 @@
} }
} }
_okButton.hidden = NO; _doneButton.hidden = NO;
_selectButton.hidden = !_tzImagePickerVc.showSelectBtn; _selectButton.hidden = !_tzImagePickerVc.showSelectBtn;
// 让宽度/高度小于 最小可选照片尺寸 的图片不能选中 // 让宽度/高度小于 最小可选照片尺寸 的图片不能选中
if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) { if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {
...@@ -406,7 +408,7 @@ ...@@ -406,7 +408,7 @@
_selectButton.hidden = YES; _selectButton.hidden = YES;
_originalPhotoButton.hidden = YES; _originalPhotoButton.hidden = YES;
_originalPhotoLable.hidden = YES; _originalPhotoLable.hidden = YES;
_okButton.hidden = YES; _doneButton.hidden = YES;
} }
} }
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor]; self.view.backgroundColor = [UIColor blackColor];
self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Preview"]; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
self.navigationItem.title = tzImagePickerVc.previewBtnTitleStr;
[self configMoviePlayer]; [self configMoviePlayer];
} }
...@@ -84,7 +85,8 @@ ...@@ -84,7 +85,8 @@
_okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44); _okButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44);
_okButton.titleLabel.font = [UIFont systemFontOfSize:16]; _okButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_okButton addTarget:self action:@selector(okButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_okButton addTarget:self action:@selector(okButtonClick) forControlEvents:UIControlEventTouchUpInside];
[_okButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal]; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[_okButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[_okButton setTitleColor:imagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal]; [_okButton setTitleColor:imagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
_selectedPhotos = [NSMutableArray array]; _selectedPhotos = [NSMutableArray array];
_selectedAssets = [NSMutableArray array]; _selectedAssets = [NSMutableArray array];
[self configCollectionView]; [self configCollectionView];
self.maxCountTF.text = @"1";
} }
- (BOOL)prefersStatusBarHidden { - (BOOL)prefersStatusBarHidden {
...@@ -237,6 +236,10 @@ ...@@ -237,6 +236,10 @@
cropView.layer.borderColor = [UIColor redColor].CGColor; cropView.layer.borderColor = [UIColor redColor].CGColor;
cropView.layer.borderWidth = 2.0; cropView.layer.borderWidth = 2.0;
}]; }];
/*
[imagePickerVc setCropBgViewSettingBlock:^(UIView *cropBgView) {
cropBgView.alpha = 0.5;
}];*/
#pragma mark - 到这里为止 #pragma mark - 到这里为止
// You can get the photos by block, the same as by delegate. // You can get the photos by block, the same as by delegate.
......
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