更改系统相机UIImagePickerController导航栏的cancle为取消按钮
Posted 努力的小小四
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更改系统相机UIImagePickerController导航栏的cancle为取消按钮相关的知识,希望对你有一定的参考价值。
第一:实现navigationController代理
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
UIButton *cusbtn = [[UIButton alloc]initWithFrame:CGRectMake(0,0,50,30)];
[cusbtn setTitle:@"取消" forState:(UIControlStateNormal)];
cusbtn.backgroundColor = [UIColor redColor];
[cusbtn addTarget:self action:@selector(click) forControlEvents:(UIControlEventTouchUpInside)];
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithCustomView:cusbtn];
[viewController.navigationItem setRightBarButtonItem:btn animated:NO];
}
第二:实现click方法即可完成;self.imagePicker为弱引用
@property (nonatomic, weak) UIImagePickerController *imagePicker;
- (void)click{
[self imagePickerControllerDidCancel:self.imagePicker];
}
以上是关于更改系统相机UIImagePickerController导航栏的cancle为取消按钮的主要内容,如果未能解决你的问题,请参考以下文章