码迷,mamicode.com
首页 > 其他好文 > 详细

更改系统相机UIImagePickerController导航栏的cancle为取消按钮

时间:2016-07-05 11:53:18      阅读:985      评论:0      收藏:0      [点我收藏+]

标签:

第一:实现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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!