ios UIImagePickerController "取消"

2020-08-08  本文已影响0人  天山海梦

一些网上的方法设置无效:
第一种:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker
animated:YES
completion:^(void){
UIViewController * vc = controller.viewControllers.lastObject;
UIBarButtonItem * cancelBtn = [vc valueForKey:@"imagePickerCancelButton"];
UIButton * button = [cancelBtn valueForKey:@"view"];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
}];

第二种:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker. navigationController.navigationBar.tintColor = [UIColor blackColor];
picker. navigationController.navigationBar.topItem.rightBarButtonItem.tintColor = [UIColor whiteColor];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];

最后尝试有效方法:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];
picker.navigationBar.tintColor = [UIColor redColor];
picker.navigationBar.barStyle = UIBarStyleBlackOpaque;
picker.navigationBar.topItem.rightBarButtonItem.tintColor = [UIColor blackColor];

最后希望这个篇文章能帮助遇到此类问题的小伙伴们。。。。记得点赞啊 !!!

上一篇下一篇

猜你喜欢

热点阅读