iPhone相机无法从横向应用程序打开 [英] iPhone camera can't open from landscape application

查看:216
本文介绍了iPhone相机无法从横向应用程序打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用使用mapkit的sdk 3.0创建仅风景应用程序。我需要在我的应用程序使用iphone摄像头。但我尝试打开相机时会收到以下警告。



无法执行全屏转换。fromViewController的视图必须位于视图中,屏幕。



我称之为相机方法的视图是mapview,大小为480 * 320。我写了以下代码来调用摄像头:

  UIImagePickerController * picker = [[UIImagePickerController alloc] init]; 
picker.delegate = self;

picker.sourceType = UIImagePickerControllerSourceTypeCamera;

[self presentModalViewController:picker animated:YES];
[picker release];

之后,我写了通常的方法:

   - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo 
pre>

但这从来不被调用,因为相机从未打开过。所以我的问题是我在这里缺少...?我在实际的iphone设备,而不是在模拟器上测试这个程序。我已经使用这个代码在另一个应用程序,它工作正常。但在这里,它根本不工作!

$ p $ b

解决方案

只要用父ViewController替换self you appDelegate。


I am creating a landscape only application using sdk 3.0 that uses mapkit. I need to use iphone camera in my application. But I am getting following warning when I try to open camera.

"Can't perform full-screen transition. The fromViewController's view must be within a view that occupies the full screen."

The view from which I am calling camera method is mapview with size of 480*320. I have written following code to call camera:

UIImagePickerController *picker = [[UIImagePickerController alloc]init];
picker.delegate = self;

picker.sourceType=UIImagePickerControllerSourceTypeCamera;

[self presentModalViewController: picker animated:YES];
[picker release];

After that I have written the usual method :

-(void)imagePickerController : (UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image  editingInfo : (NSDictionary *)editingInfo

But this is never called , since camera is never opened. So my question is what am I missing here...? I am testing this app on actual iphone device , not on simulator. I have used this code in another app and it works fine. But here, it simply doesnt work! Plz help if you have any idea about this..

解决方案

just replace "self" with the parent ViewController which is probably declared in you appDelegate.

这篇关于iPhone相机无法从横向应用程序打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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