Displaying UIImagePickerController within another UIView

↘锁芯ラ 提交于 2019-11-29 15:27:24

All you need to do is call viewWillAppear and viewDidAppear.

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

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

Call viewWillAppear:YES on the image picker controller after adding its view to your view. Skip the modal view controller business.

TechZen

I don't think the API provides direct access to the actual view of the UIImagePickerController. The class is actually a subclass of UINavigationController so I don't think it has an actual view itself but rather manages the calling of its subcontrollers and their views.

When you call the UIImagePickerController modally, its doesn't add the views it controls as subviews to the window (or any other view). That is what a modal view means. It presents the view off to the "side" of the view hierarchy.

Even if you could hack this together, I think Apple would reject it as not being part of the API and for violating the HIG.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!