zoukankan      html  css  js  c++  java
  • 更改系统相机UIImagePickerController导航栏的cancle为自定义按钮

    有时候需要对系统相册里面的取消按钮进行自定义,并获取点击事件做一些操作,那么你可以这样做。

    第一:实现navigationController代理

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated

    {

        UIButton *cancelBtn = [[UIButton alloc]initWithFrame:CGRectMake(0,0,50,30)];

        [cancelBtn setTitle:@"取消" forState:(UIControlStateNormal)];

        cancelBtn.backgroundColor = [UIColor redColor];

        [cancelBtn addTarget:self action:@selector(click) forControlEvents:(UIControlEventTouchUpInside)];

        UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithCustomView:cancelBtn];

        [viewController.navigationItem setRightBarButtonItem:btn animated:NO]; 

    }

    第二:实现click方法即可完成;self.imagePicker为弱引用

    @property (nonatomic, weak) UIImagePickerController *imagePicker;

    - (void)click{

    //做你需要做的事情

        [self imagePickerControllerDidCancel:self.imagePicker];

    }

     

  • 相关阅读:
    rzc generate exited with code -2147450730.
    c#WebService动态调用
    c#BarTender打印,打印微调
    记一次ios下h5页面图片显示问题
    FID
    RSA密钥对生成,并解析公钥指数和模数
    angularjs-6
    angularjs-5
    angularjs-4
    angularjs-4
  • 原文地址:https://www.cnblogs.com/xsiOS/p/5642846.html
Copyright © 2011-2022 走看看