在另一个UIView中显示UIImagePickerController [英] Displaying UIImagePickerController within another UIView

查看:136
本文介绍了在另一个UIView中显示UIImagePickerController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UIImagePickerController的最后几个月工作的很多,尤其是在OS3.1中的新功能,以及相机视图顶部的重叠视图。这已经很好了。

I've been working pretty extensively the last couple months with UIImagePickerController, particularly with the new capabilities in OS3.1 and newer to overlay views on-top of the camera view. This has worked just fine.

但是,我目前正在一个项目,我想在现有视图中显示UIImagePickerController的摄像机视图。

However, I am currently working on a project where I'd like to be able to display the camera view of the UIImagePickerController within an existing view. Essentially, the exact opposite of what I've currently been doing.

一个例子是带有导航组件的View控制器(想想顶部和底部的水平条带渐变),并且在点击这些条之一上的按钮时,内容区域显示相机视图。快门动画应该向上,顶部和底部的导航栏将始终在顶部。

An example would be a View Controller with navigation components (Think top and bottom horizontal bars with gradients), and upon tapping a button on one of these bars, then content area displays the camera view. The shutter animation would should up, and the top and bottom navigation bars would remain always on-top.

我已经成功添加UIImagePickerController到窗口视图,作为

I've had success adding the UIImagePickerController to the window view, as well as presenting it modally, but haven't had any luck adding it as a subView.

例如:

[window addSubview:camera.view];
[self presentModalViewController:camera animated:YES];


推荐答案

所有你需要做的是调用viewWillAppear和viewDidAppear。

All you need to do is call viewWillAppear and viewDidAppear.

下面是一个示例,其中_pickerController是UIImagePickerController的实例:

Here is an example where _pickerController is an instance of UIImagePickerController:

[self.view addSubview:_pickerController.view];
[_pickerController viewWillAppear:YES];
[_pickerController viewDidAppear:YES];

这篇关于在另一个UIView中显示UIImagePickerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆