Commit 85fcec7c authored by Zhen Tan's avatar Zhen Tan Committed by GitHub

Merge pull request #328 from Fnoz/master

增加“图片选择页面,可定制 naviBar 的标题、背景色样式”;
parents 6861cf66 1dd299d1
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
@interface TZAlbumCell () @interface TZAlbumCell ()
@property (weak, nonatomic) UIImageView *posterImageView; @property (weak, nonatomic) UIImageView *posterImageView;
@property (weak, nonatomic) UILabel *titleLable; @property (weak, nonatomic) UILabel *titleLabel;
@property (weak, nonatomic) UIImageView *arrowImageView; @property (weak, nonatomic) UIImageView *arrowImageView;
@end @end
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor blackColor]}]; NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor blackColor]}];
NSAttributedString *countString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" (%zd)",model.count] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor lightGrayColor]}]; NSAttributedString *countString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" (%zd)",model.count] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor lightGrayColor]}];
[nameString appendAttributedString:countString]; [nameString appendAttributedString:countString];
self.titleLable.attributedText = nameString; self.titleLabel.attributedText = nameString;
[[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) { [[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {
self.posterImageView.image = postImage; self.posterImageView.image = postImage;
}]; }];
...@@ -283,17 +283,17 @@ ...@@ -283,17 +283,17 @@
return _posterImageView; return _posterImageView;
} }
- (UILabel *)titleLable { - (UILabel *)titleLabel {
if (_titleLable == nil) { if (_titleLabel == nil) {
UILabel *titleLable = [[UILabel alloc] init]; UILabel *titleLabel = [[UILabel alloc] init];
titleLable.font = [UIFont boldSystemFontOfSize:17]; titleLabel.font = [UIFont boldSystemFontOfSize:17];
titleLable.frame = CGRectMake(80, 0, self.tz_width - 80 - 50, self.tz_height); titleLabel.frame = CGRectMake(80, 0, self.tz_width - 80 - 50, self.tz_height);
titleLable.textColor = [UIColor blackColor]; titleLabel.textColor = [UIColor blackColor];
titleLable.textAlignment = NSTextAlignmentLeft; titleLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:titleLable]; [self.contentView addSubview:titleLabel];
_titleLable = titleLable; _titleLabel = titleLabel;
} }
return _titleLable; return _titleLabel;
} }
- (UIImageView *)arrowImageView { - (UIImageView *)arrowImageView {
......
...@@ -78,14 +78,14 @@ ...@@ -78,14 +78,14 @@
} }
[_toolBar addSubview:_doneButton]; [_toolBar addSubview:_doneButton];
UILabel *byteLable = [[UILabel alloc] init]; UILabel *byteLabel = [[UILabel alloc] init];
byteLable.textColor = [UIColor whiteColor]; byteLabel.textColor = [UIColor whiteColor];
byteLable.font = [UIFont systemFontOfSize:13]; byteLabel.font = [UIFont systemFontOfSize:13];
byteLable.frame = CGRectMake(10, 0, 100, 44); byteLabel.frame = CGRectMake(10, 0, 100, 44);
[[TZImageManager manager] getPhotosBytesWithArray:@[_model] completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:@[_model] completion:^(NSString *totalBytes) {
byteLable.text = totalBytes; byteLabel.text = totalBytes;
}]; }];
[_toolBar addSubview:byteLable]; [_toolBar addSubview:byteLabel];
[self.view addSubview:_toolBar]; [self.view addSubview:_toolBar];
} }
......
...@@ -127,6 +127,9 @@ ...@@ -127,6 +127,9 @@
/// 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 *naviBgColor;
@property (nonatomic, strong) UIColor *naviTitleColor;
@property (nonatomic, strong) UIFont *naviTitleFont;
@property (nonatomic, strong) UIColor *barItemTextColor; @property (nonatomic, strong) UIColor *barItemTextColor;
@property (nonatomic, strong) UIFont *barItemTextFont; @property (nonatomic, strong) UIFont *barItemTextFont;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
@interface TZImagePickerController () { @interface TZImagePickerController () {
NSTimer *_timer; NSTimer *_timer;
UILabel *_tipLable; UILabel *_tipLabel;
UIButton *_settingBtn; UIButton *_settingBtn;
BOOL _pushPhotoPickerVc; BOOL _pushPhotoPickerVc;
BOOL _didPushPhotoPickerVc; BOOL _didPushPhotoPickerVc;
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
UIButton *_progressHUD; UIButton *_progressHUD;
UIView *_HUDContainer; UIView *_HUDContainer;
UIActivityIndicatorView *_HUDIndicatorView; UIActivityIndicatorView *_HUDIndicatorView;
UILabel *_HUDLable; UILabel *_HUDLabel;
UIStatusBarStyle _originStatusBarStyle; UIStatusBarStyle _originStatusBarStyle;
} }
...@@ -56,6 +56,28 @@ ...@@ -56,6 +56,28 @@
} }
} }
- (void)setNaviBgColor:(UIColor *)naviBgColor {
_naviBgColor = naviBgColor;
self.navigationBar.barTintColor = naviBgColor;
}
- (void)setNaviTitleColor:(UIColor *)naviTitleColor {
_naviTitleColor = naviTitleColor;
[self configNaviTitleAppearance];
}
- (void)setNaviTitleFont:(UIFont *)naviTitleFont {
_naviTitleFont = naviTitleFont;
[self configNaviTitleAppearance];
}
- (void)configNaviTitleAppearance {
NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
textAttrs[NSForegroundColorAttributeName] = self.naviTitleColor;
textAttrs[NSFontAttributeName] = self.naviTitleFont;
self.navigationBar.titleTextAttributes = textAttrs;
}
- (void)setBarItemTextFont:(UIFont *)barItemTextFont { - (void)setBarItemTextFont:(UIFont *)barItemTextFont {
_barItemTextFont = barItemTextFont; _barItemTextFont = barItemTextFont;
[self configBarButtonItemAppearance]; [self configBarButtonItemAppearance];
...@@ -121,17 +143,17 @@ ...@@ -121,17 +143,17 @@
[self configDefaultSetting]; [self configDefaultSetting];
if (![[TZImageManager manager] authorizationStatusAuthorized]) { if (![[TZImageManager manager] authorizationStatusAuthorized]) {
_tipLable = [[UILabel alloc] init]; _tipLabel = [[UILabel alloc] init];
_tipLable.frame = CGRectMake(8, 120, self.view.tz_width - 16, 60); _tipLabel.frame = CGRectMake(8, 120, self.view.tz_width - 16, 60);
_tipLable.textAlignment = NSTextAlignmentCenter; _tipLabel.textAlignment = NSTextAlignmentCenter;
_tipLable.numberOfLines = 0; _tipLabel.numberOfLines = 0;
_tipLable.font = [UIFont systemFontOfSize:16]; _tipLabel.font = [UIFont systemFontOfSize:16];
_tipLable.textColor = [UIColor blackColor]; _tipLabel.textColor = [UIColor blackColor];
NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"]; NSString *appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleDisplayName"];
if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"]; if (!appName) appName = [[NSBundle mainBundle].infoDictionary valueForKey:@"CFBundleName"];
NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName]; NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName];
_tipLable.text = tipText; _tipLabel.text = tipText;
[self.view addSubview:_tipLable]; [self.view addSubview:_tipLabel];
_settingBtn = [UIButton buttonWithType:UIButtonTypeSystem]; _settingBtn = [UIButton buttonWithType:UIButtonTypeSystem];
[_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal]; [_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal];
...@@ -200,6 +222,8 @@ ...@@ -200,6 +222,8 @@
self.timeout = 15; self.timeout = 15;
self.photoWidth = 828.0; self.photoWidth = 828.0;
self.photoPreviewMaxWidth = 600; self.photoPreviewMaxWidth = 600;
self.naviTitleColor = [UIColor whiteColor];
self.naviTitleFont = [UIFont systemFontOfSize:17];
self.barItemTextFont = [UIFont systemFontOfSize:15]; self.barItemTextFont = [UIFont systemFontOfSize:15];
self.barItemTextColor = [UIColor whiteColor]; self.barItemTextColor = [UIColor whiteColor];
self.allowPreview = YES; self.allowPreview = YES;
...@@ -229,7 +253,7 @@ ...@@ -229,7 +253,7 @@
- (void)observeAuthrizationStatusChange { - (void)observeAuthrizationStatusChange {
if ([[TZImageManager manager] authorizationStatusAuthorized]) { if ([[TZImageManager manager] authorizationStatusAuthorized]) {
[_tipLable removeFromSuperview]; [_tipLabel removeFromSuperview];
[_settingBtn removeFromSuperview]; [_settingBtn removeFromSuperview];
[_timer invalidate]; [_timer invalidate];
_timer = nil; _timer = nil;
...@@ -277,14 +301,14 @@ ...@@ -277,14 +301,14 @@
_HUDIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; _HUDIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
_HUDIndicatorView.frame = CGRectMake(45, 15, 30, 30); _HUDIndicatorView.frame = CGRectMake(45, 15, 30, 30);
_HUDLable = [[UILabel alloc] init]; _HUDLabel = [[UILabel alloc] init];
_HUDLable.frame = CGRectMake(0,40, 120, 50); _HUDLabel.frame = CGRectMake(0,40, 120, 50);
_HUDLable.textAlignment = NSTextAlignmentCenter; _HUDLabel.textAlignment = NSTextAlignmentCenter;
_HUDLable.text = self.processHintStr; _HUDLabel.text = self.processHintStr;
_HUDLable.font = [UIFont systemFontOfSize:15]; _HUDLabel.font = [UIFont systemFontOfSize:15];
_HUDLable.textColor = [UIColor whiteColor]; _HUDLabel.textColor = [UIColor whiteColor];
[_HUDContainer addSubview:_HUDLable]; [_HUDContainer addSubview:_HUDLabel];
[_HUDContainer addSubview:_HUDIndicatorView]; [_HUDContainer addSubview:_HUDIndicatorView];
[_progressHUD addSubview:_HUDContainer]; [_progressHUD addSubview:_HUDContainer];
} }
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
UIButton *_previewButton; UIButton *_previewButton;
UIButton *_doneButton; UIButton *_doneButton;
UIImageView *_numberImageView; UIImageView *_numberImageView;
UILabel *_numberLable; UILabel *_numberLabel;
UIButton *_originalPhotoButton; UIButton *_originalPhotoButton;
UILabel *_originalPhotoLable; UILabel *_originalPhotoLabel;
BOOL _shouldScrollToBottom; BOOL _shouldScrollToBottom;
BOOL _showTakePhotoBtn; BOOL _showTakePhotoBtn;
...@@ -218,11 +218,11 @@ static CGSize AssetGridThumbnailSize; ...@@ -218,11 +218,11 @@ static CGSize AssetGridThumbnailSize;
_originalPhotoButton.selected = _isSelectOriginalPhoto; _originalPhotoButton.selected = _isSelectOriginalPhoto;
_originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0; _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;
_originalPhotoLable = [[UILabel alloc] init]; _originalPhotoLabel = [[UILabel alloc] init];
_originalPhotoLable.frame = CGRectMake(fullImageWidth + 46, 0, 80, 50); _originalPhotoLabel.frame = CGRectMake(fullImageWidth + 46, 0, 80, 50);
_originalPhotoLable.textAlignment = NSTextAlignmentLeft; _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;
_originalPhotoLable.font = [UIFont systemFontOfSize:16]; _originalPhotoLabel.font = [UIFont systemFontOfSize:16];
_originalPhotoLable.textColor = [UIColor blackColor]; _originalPhotoLabel.textColor = [UIColor blackColor];
if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes]; if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
} }
...@@ -241,14 +241,14 @@ static CGSize AssetGridThumbnailSize; ...@@ -241,14 +241,14 @@ static CGSize AssetGridThumbnailSize;
_numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0; _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;
_numberImageView.backgroundColor = [UIColor clearColor]; _numberImageView.backgroundColor = [UIColor clearColor];
_numberLable = [[UILabel alloc] init]; _numberLabel = [[UILabel alloc] init];
_numberLable.frame = _numberImageView.frame; _numberLabel.frame = _numberImageView.frame;
_numberLable.font = [UIFont systemFontOfSize:15]; _numberLabel.font = [UIFont systemFontOfSize:15];
_numberLable.textColor = [UIColor whiteColor]; _numberLabel.textColor = [UIColor whiteColor];
_numberLable.textAlignment = NSTextAlignmentCenter; _numberLabel.textAlignment = NSTextAlignmentCenter;
_numberLable.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count];
_numberLable.hidden = tzImagePickerVc.selectedModels.count <= 0; _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;
_numberLable.backgroundColor = [UIColor clearColor]; _numberLabel.backgroundColor = [UIColor clearColor];
UIView *divide = [[UIView alloc] init]; UIView *divide = [[UIView alloc] init];
CGFloat rgb2 = 222 / 255.0; CGFloat rgb2 = 222 / 255.0;
...@@ -259,10 +259,10 @@ static CGSize AssetGridThumbnailSize; ...@@ -259,10 +259,10 @@ static CGSize AssetGridThumbnailSize;
[bottomToolBar addSubview:_previewButton]; [bottomToolBar addSubview:_previewButton];
[bottomToolBar addSubview:_doneButton]; [bottomToolBar addSubview:_doneButton];
[bottomToolBar addSubview:_numberImageView]; [bottomToolBar addSubview:_numberImageView];
[bottomToolBar addSubview:_numberLable]; [bottomToolBar addSubview:_numberLabel];
[self.view addSubview:bottomToolBar]; [self.view addSubview:bottomToolBar];
[self.view addSubview:_originalPhotoButton]; [self.view addSubview:_originalPhotoButton];
[_originalPhotoButton addSubview:_originalPhotoLable]; [_originalPhotoButton addSubview:_originalPhotoLabel];
} }
#pragma mark - Click Event #pragma mark - Click Event
...@@ -275,7 +275,7 @@ static CGSize AssetGridThumbnailSize; ...@@ -275,7 +275,7 @@ static CGSize AssetGridThumbnailSize;
- (void)originalPhotoButtonClick { - (void)originalPhotoButtonClick {
_originalPhotoButton.selected = !_originalPhotoButton.isSelected; _originalPhotoButton.selected = !_originalPhotoButton.isSelected;
_isSelectOriginalPhoto = _originalPhotoButton.isSelected; _isSelectOriginalPhoto = _originalPhotoButton.isSelected;
_originalPhotoLable.hidden = !_originalPhotoButton.isSelected; _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;
if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes]; if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
} }
...@@ -505,12 +505,12 @@ static CGSize AssetGridThumbnailSize; ...@@ -505,12 +505,12 @@ static CGSize AssetGridThumbnailSize;
_doneButton.enabled = tzImagePickerVc.selectedModels.count > 0 || tzImagePickerVc.alwaysEnableDoneBtn; _doneButton.enabled = tzImagePickerVc.selectedModels.count > 0 || tzImagePickerVc.alwaysEnableDoneBtn;
_numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0; _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;
_numberLable.hidden = tzImagePickerVc.selectedModels.count <= 0; _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;
_numberLable.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count]; _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count];
_originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0; _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;
_originalPhotoButton.selected = (_isSelectOriginalPhoto && _originalPhotoButton.enabled); _originalPhotoButton.selected = (_isSelectOriginalPhoto && _originalPhotoButton.enabled);
_originalPhotoLable.hidden = (!_originalPhotoButton.isSelected); _originalPhotoLabel.hidden = (!_originalPhotoButton.isSelected);
if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes]; if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
} }
...@@ -535,7 +535,7 @@ static CGSize AssetGridThumbnailSize; ...@@ -535,7 +535,7 @@ static CGSize AssetGridThumbnailSize;
- (void)getSelectedPhotoBytes { - (void)getSelectedPhotoBytes {
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) {
_originalPhotoLable.text = [NSString stringWithFormat:@"(%@)",totalBytes]; _originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
}]; }];
} }
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
UIView *_toolBar; UIView *_toolBar;
UIButton *_doneButton; UIButton *_doneButton;
UIImageView *_numberImageView; UIImageView *_numberImageView;
UILabel *_numberLable; UILabel *_numberLabel;
UIButton *_originalPhotoButton; UIButton *_originalPhotoButton;
UILabel *_originalPhotoLable; UILabel *_originalPhotoLabel;
} }
@property (nonatomic, assign) BOOL isHideNaviBar; @property (nonatomic, assign) BOOL isHideNaviBar;
@property (nonatomic, strong) UIView *cropBgView; @property (nonatomic, strong) UIView *cropBgView;
...@@ -123,12 +123,12 @@ ...@@ -123,12 +123,12 @@
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoPreviewOriginDefImageName] forState:UIControlStateNormal]; [_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoPreviewOriginDefImageName] forState:UIControlStateNormal];
[_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoOriginSelImageName] forState:UIControlStateSelected]; [_originalPhotoButton setImage:[UIImage imageNamedFromMyBundle:_tzImagePickerVc.photoOriginSelImageName] forState:UIControlStateSelected];
_originalPhotoLable = [[UILabel alloc] init]; _originalPhotoLabel = [[UILabel alloc] init];
_originalPhotoLable.frame = CGRectMake(fullImageWidth + 42, 0, 80, 44); _originalPhotoLabel.frame = CGRectMake(fullImageWidth + 42, 0, 80, 44);
_originalPhotoLable.textAlignment = NSTextAlignmentLeft; _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;
_originalPhotoLable.font = [UIFont systemFontOfSize:13]; _originalPhotoLabel.font = [UIFont systemFontOfSize:13];
_originalPhotoLable.textColor = [UIColor whiteColor]; _originalPhotoLabel.textColor = [UIColor whiteColor];
_originalPhotoLable.backgroundColor = [UIColor clearColor]; _originalPhotoLabel.backgroundColor = [UIColor clearColor];
if (_isSelectOriginalPhoto) [self showPhotoBytes]; if (_isSelectOriginalPhoto) [self showPhotoBytes];
} }
...@@ -144,20 +144,20 @@ ...@@ -144,20 +144,20 @@
_numberImageView.frame = CGRectMake(self.view.tz_width - 56 - 28, 7, 30, 30); _numberImageView.frame = CGRectMake(self.view.tz_width - 56 - 28, 7, 30, 30);
_numberImageView.hidden = _tzImagePickerVc.selectedModels.count <= 0; _numberImageView.hidden = _tzImagePickerVc.selectedModels.count <= 0;
_numberLable = [[UILabel alloc] init]; _numberLabel = [[UILabel alloc] init];
_numberLable.frame = _numberImageView.frame; _numberLabel.frame = _numberImageView.frame;
_numberLable.font = [UIFont systemFontOfSize:15]; _numberLabel.font = [UIFont systemFontOfSize:15];
_numberLable.textColor = [UIColor whiteColor]; _numberLabel.textColor = [UIColor whiteColor];
_numberLable.textAlignment = NSTextAlignmentCenter; _numberLabel.textAlignment = NSTextAlignmentCenter;
_numberLable.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count];
_numberLable.hidden = _tzImagePickerVc.selectedModels.count <= 0; _numberLabel.hidden = _tzImagePickerVc.selectedModels.count <= 0;
_numberLable.backgroundColor = [UIColor clearColor]; _numberLabel.backgroundColor = [UIColor clearColor];
[_originalPhotoButton addSubview:_originalPhotoLable]; [_originalPhotoButton addSubview:_originalPhotoLabel];
[_toolBar addSubview:_doneButton]; [_toolBar addSubview:_doneButton];
[_toolBar addSubview:_originalPhotoButton]; [_toolBar addSubview:_originalPhotoButton];
[_toolBar addSubview:_numberImageView]; [_toolBar addSubview:_numberImageView];
[_toolBar addSubview:_numberLable]; [_toolBar addSubview:_numberLabel];
[self.view addSubview:_toolBar]; [self.view addSubview:_toolBar];
} }
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
- (void)originalPhotoButtonClick { - (void)originalPhotoButtonClick {
_originalPhotoButton.selected = !_originalPhotoButton.isSelected; _originalPhotoButton.selected = !_originalPhotoButton.isSelected;
_isSelectOriginalPhoto = _originalPhotoButton.isSelected; _isSelectOriginalPhoto = _originalPhotoButton.isSelected;
_originalPhotoLable.hidden = !_originalPhotoButton.isSelected; _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;
if (_isSelectOriginalPhoto) { if (_isSelectOriginalPhoto) {
[self showPhotoBytes]; [self showPhotoBytes];
if (!_selectButton.isSelected) { if (!_selectButton.isSelected) {
...@@ -391,12 +391,12 @@ ...@@ -391,12 +391,12 @@
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
TZAssetModel *model = _models[_currentIndex]; TZAssetModel *model = _models[_currentIndex];
_selectButton.selected = model.isSelected; _selectButton.selected = model.isSelected;
_numberLable.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count]; _numberLabel.text = [NSString stringWithFormat:@"%zd",_tzImagePickerVc.selectedModels.count];
_numberImageView.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); _numberImageView.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage);
_numberLable.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage); _numberLabel.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage);
_originalPhotoButton.selected = _isSelectOriginalPhoto; _originalPhotoButton.selected = _isSelectOriginalPhoto;
_originalPhotoLable.hidden = !_originalPhotoButton.isSelected; _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;
if (_isSelectOriginalPhoto) [self showPhotoBytes]; if (_isSelectOriginalPhoto) [self showPhotoBytes];
// If is previewing video, hide original photo button // If is previewing video, hide original photo button
...@@ -404,10 +404,10 @@ ...@@ -404,10 +404,10 @@
if (!_isHideNaviBar) { if (!_isHideNaviBar) {
if (model.type == TZAssetModelMediaTypeVideo) { if (model.type == TZAssetModelMediaTypeVideo) {
_originalPhotoButton.hidden = YES; _originalPhotoButton.hidden = YES;
_originalPhotoLable.hidden = YES; _originalPhotoLabel.hidden = YES;
} else { } else {
_originalPhotoButton.hidden = NO; _originalPhotoButton.hidden = NO;
if (_isSelectOriginalPhoto) _originalPhotoLable.hidden = NO; if (_isSelectOriginalPhoto) _originalPhotoLabel.hidden = NO;
} }
} }
...@@ -415,18 +415,18 @@ ...@@ -415,18 +415,18 @@
_selectButton.hidden = !_tzImagePickerVc.showSelectBtn; _selectButton.hidden = !_tzImagePickerVc.showSelectBtn;
// 让宽度/高度小于 最小可选照片尺寸 的图片不能选中 // 让宽度/高度小于 最小可选照片尺寸 的图片不能选中
if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) { if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {
_numberLable.hidden = YES; _numberLabel.hidden = YES;
_numberImageView.hidden = YES; _numberImageView.hidden = YES;
_selectButton.hidden = YES; _selectButton.hidden = YES;
_originalPhotoButton.hidden = YES; _originalPhotoButton.hidden = YES;
_originalPhotoLable.hidden = YES; _originalPhotoLabel.hidden = YES;
_doneButton.hidden = YES; _doneButton.hidden = YES;
} }
} }
- (void)showPhotoBytes { - (void)showPhotoBytes {
[[TZImageManager manager] getPhotosBytesWithArray:@[_models[_currentIndex]] completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:@[_models[_currentIndex]] completion:^(NSString *totalBytes) {
_originalPhotoLable.text = [NSString stringWithFormat:@"(%@)",totalBytes]; _originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
}]; }];
} }
......
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