标签:
第一:实现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为取消按钮
标签:
原文地址:http://www.cnblogs.com/xsiOS/p/5642846.html