今天想实现一个类似Path 的Photo Picker的效果,没有Cancel按钮,取而代之的是添加一个从相册获取的按钮,要知道这在官方的SDK里面是没有。
开始之前,先做下功课,找到几个相关的文章

http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimagepickercontroller/

http://www.cocoachina.com/bbs/read.php?tid-11664-page-1.html>
以下的这个框架图对接下来的工作会很有帮助
红色的高亮部分是从屏幕上看到的照片的预览图,除了这个之外,他上面的view都可以去掉。
要想编辑这些个View,得先找到他们,这里给出了个方法

#pragma mark get/show the UIView we want
//Find the view we want in camera structure.
-(UIView *)findView:(UIView *)aView withName:(NSString *)name{
    Class cl = [aView class];
    NSString *desc = [cl description];

if ([name isEqualToString:desc])
        return aView;

for (NSUInteger i = 0; i < [aView.subviews count]; i++)
    {
        UIView *subView = [aView.subviews objectAtIndex:i];
        subView = [self findView:subView withName:name];
        if (subView)
            return subView;
    }
    return nil;
}

怎么用,下面这段代码里给出了比较详细的例子

-(void)addSomeElements:(UIViewController *)viewController{
    //Add the motion view here, PLCameraView and picker.view are both OK
    UIView *PLCameraView=[self findView:viewController.view withName:@"PLCameraView"];
    [PLCameraView addSubview:touchView];//[viewController.view addSubview:self.touchView];//You can also try this one.

//Add button for Timer capture
    [PLCameraView addSubview:timerButton];
    [PLCameraView addSubview:continuousButton];

[PLCameraView insertSubview:bottomBarImageView atIndex:1];

//Used to hide the transiton, last added view will be the topest layer
    [PLCameraView addSubview:myTransitionView];

//Add label to cropOverlay
    UIView *cropOverlay=[self findView:PLCameraView withName:@"PLCropOverlay"];
    [cropOverlay addSubview:lblWatermark];

//Get Bottom Bar
    UIView *bottomBar=[self findView:PLCameraView withName:@"PLCropOverlayBottomBar"];

//Get ImageView For Save
    UIImageView *bottomBarImageForSave = [bottomBar.subviews objectAtIndex:0];

//Get Button 0
    UIButton *retakeButton=[bottomBarImageForSave.subviews objectAtIndex:0];
    [retakeButton setTitle:@"重拍" forState:UIControlStateNormal];

//Get Button 1
    UIButton *useButton=[bottomBarImageForSave.subviews objectAtIndex:1];
    [useButton setTitle:@"保存" forState:UIControlStateNormal];

//Get ImageView For Camera
    UIImageView *bottomBarImageForCamera = [bottomBar.subviews objectAtIndex:1];

//Set Bottom Bar Image
    UIImage *image=[[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"BottomBar.png"]];
    bottomBarImageForCamera.image=image;
    [image release];

//Get Button 0(The Capture Button)
    UIButton *cameraButton=[bottomBarImageForCamera.subviews objectAtIndex:0];
    [cameraButton addTarget:self action:@selector(hideTouchView) forControlEvents:UIControlEventTouchUpInside];

//Get Button 1
    UIButton *cancelButton=[bottomBarImageForCamera.subviews objectAtIndex:1];
    [cancelButton setTitle:@"取消" forState:UIControlStateNormal];
    [cancelButton addTarget:self action:@selector(hideTouchView) forControlEvents:UIControlEventTouchUpInside];
}

++++++++++++++++++++++++++++
兔子说可以这么实现:
先 picker.showsCameraControls=NO;
然后自己自定义 picker.cameraOverlayView
有待验证~
[picker.topViewController.navigationController pushViewController:controller animated:YES];

转 http://blog.cnrainbird.com/index.php/2012/03/14/zhong_ding_yi_-uiimagepickercontroller/

以下还有其它的资料:

http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimagepickercontroller/

http://hi.baidu.com/lishiq820/item/81011ee084ed4015595dd822

转载于:https://www.cnblogs.com/likwo/archive/2012/07/07/2580669.html

重定义 UIImagePickerController相关推荐

  1. MLIR: 编译器基础架构重定义

    MLIR: 编译器基础架构重定义 MLIR(多级中间表示)是语言(如 C)或库(如 TensorFlow)与编译器后端(如 LLVM)之间的中间表示 (IR) 系统.允许不同语言的不同编译器堆栈之间的 ...

  2. java双目运算符重载,c++类的单目和双目运算符的重定义

    这个里面需要注意的是对于双目运算符,像是加号,如果是复数加整数是一种情况,而整数加复数又是另一种情况,所以需要重定义两次. 而对于单目运算符,如果是前缀的,直接重定义就可以了,但是如果是后缀的,我们在 ...

  3. 继承和多态 1.0 -- 继承概念(is-a、has-a,赋值兼容规则,隐藏重定义)

    普通继承和访问权限 当一个继承没有虚拟继承或者是多重继承时,就是一个简单的继承的时候,这个时候就是一个普通的继承. 普通继承的内存空间是:子类的对象中,包含了父类的成员变量,同时也可以调用父类的成员函 ...

  4. linux下出现重定义,Oracle Online Redefinition在线重定义

    在线重定义特性进行数据表Online的结构变动操作.本篇我们从一个较复杂的案例出发,讨论复杂变化情况下如何进行Online Redefinition,以及dbms_redefinition包各个关键方 ...

  5. c++ 重载、重写、重定义(隐藏)

    1.重载overload:函数名相同,参数列表不同. 重载只是在类的内部存在,或者同为全局范围.(同名,同参函数返回值不同时,会编译出错.因为系统无法知晓你到底要调用哪一个.) 2.重写overrid ...

  6. C2371 “imaxdiv_t”: 重定义;“_abs64”: 重定义;不同的链接

    C2371 "imaxdiv_t": 重定义:"_abs64": 重定义:不同的链接 原因:ffmpeg的变量与vs的变量冲突了, 解决方法: https:// ...

  7. Oracle在线重定义

    http://boylook.itpub.net/post/43144/520542 Oracle9i之前,表数据的整理是通过 alter table XXX move [tablespace XX] ...

  8. C++中的覆盖(重写)、重载、隐藏(重定义)、多态!

    例一: 首先声明Base类型的指针指向实际类型为Derived的对象,先调用基类构造函数,再调用派生类构造函数.输出Base, Derived. base->echo(); 指针是base类型, ...

  9. 类型重定义 头文件预编译设置

    这是一个比较常用的C/C++杂注,只要在头文件的最开始加入这条杂注,就能够保证头文件只被编译一次.在编写头文件的时候,如果没有加上这一句,编译器可能会编译多次这个头文件.VS编译器会报出这个头文件 里 ...

最新文章

  1. ITK:计算PCA形状模型
  2. CSDN博客代码块代码没有高亮颜色解决办法
  3. 如何提取明细表头_如何在实际操作中应用偏移修剪?
  4. VS 2017 C++查看变量
  5. 【CVPR2019】Workshops 研讨会列表及链接
  6. Numpy中的时间类型
  7. 双十一淘宝、京东服务器瘫痪大揭秘 感悟
  8. 阶段1 语言基础+高级_1-3-Java语言高级_08-JDK8新特性_第1节 常用函数接口_10_常用的函数式接口_Consumer接口中的默认方法andThen...
  9. Atitit 图像处理—图像形态学(膨胀与腐蚀)
  10. python分布式定时任务_Python 定时任务框架 APScheduler 详解
  11. 网页截长图、全图的方法
  12. 著名Wiki站点一览
  13. 自下而上分析方法-算符优先,LR(0),SLR,LR(1),LALR大全
  14. Kubernetes(k8s) 对象使用
  15. IT部门绩效考核管理思考
  16. GitHub上最火的7个spring cloud开源项目,对新手太友好了
  17. 如何成为一位数据科学家
  18. foobar2000利用cue对ape进行分轨操作及其常见问题
  19. 【优达学城测评】Using CSV Module(Python)
  20. 15个权威的PLC学习资料下载地址 (西门子、三菱、欧姆龙)

热门文章

  1. java resouce_Java 获取Resource目录下的文件解决办法
  2. mysql 用户管理_mysql 用户管理及数据权限问题总结
  3. 修改HDFS文件所有者
  4. HBase伪分布式搭建
  5. python︱写markdown一样写网页,代码快速生成web工具:streamlit 重要组件介绍(二)
  6. redis实现可重入锁
  7. 实验楼Python项目
  8. linux 远程脚本批量 scopy文件
  9. 罗曼股份抢先驶入四万亿智慧城市建设主航道
  10. 正则表达式入门30分钟——很经典的入门教材