美文网首页
ios UIImagePickerController "取消"

ios UIImagePickerController "取消"

作者: 天山海梦 | 来源:发表于2020-08-08 14:23 被阅读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];

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

相关文章

网友评论

      本文标题:ios UIImagePickerController "取消"

      本文链接:https://www.haomeiwen.com/subject/uvxhdktx.html