首页 > 其他 > 详细

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

时间:2016-07-05 11:50:45      阅读:684      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!