Skip to content

Commit b8c71c8

Browse files
author
yuzheng
committed
feat: enhance backBarButtonItem, Adapt iOS13
1 parent 11860af commit b8c71c8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ - (void)viewDidLoad {
9090
tzImagePickerVc.navLeftBarButtonSettingBlock(leftButton);
9191
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
9292
} else if (tzImagePickerVc.childViewControllers.count) {
93-
[tzImagePickerVc.childViewControllers firstObject].navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
93+
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
94+
backItem.tintColor = tzImagePickerVc.barItemTextColor;
95+
NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
96+
textAttrs[NSForegroundColorAttributeName] = tzImagePickerVc.barItemTextColor;
97+
textAttrs[NSFontAttributeName] = tzImagePickerVc.barItemTextFont;
98+
[backItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
99+
[tzImagePickerVc.childViewControllers firstObject].navigationItem.backBarButtonItem = backItem;
94100
}
95101
_showTakePhotoBtn = _model.isCameraRoll && ((tzImagePickerVc.allowTakePicture && tzImagePickerVc.allowPickingImage) || (tzImagePickerVc.allowTakeVideo && tzImagePickerVc.allowPickingVideo));
96102
// [self resetCachedAssets];

TZImagePickerController/ViewController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ - (void)pushTZImagePickerController {
257257
return;
258258
}
259259
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:self.maxCountTF.text.integerValue columnNumber:self.columnNumberTF.text.integerValue delegate:self pushPhotoPickerVc:YES];
260+
// imagePickerVc.barItemTextColor = [UIColor redColor];
261+
// imagePickerVc.naviBgColor = [UIColor whiteColor];
260262
// imagePickerVc.navigationBar.translucent = NO;
261263

262264
#pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置

0 commit comments

Comments
 (0)