views:

969

answers:

4

hi all

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..

+1  A: 

it sounds like the warning is telling you the problem: the parent view you're passing in to presentModalViewController needs to be a full-screen view. So instead of using "self" in this code you need to use something else, like the parent view controller.

now, you're going to have another problem, because the camera controller doesn't like landscape mode, so you may have to switch back to portrait mode before showing it....

David Maymudes
A: 

Thanks David for your reply.

Here is what I have found: I am using camera functionality in my second page (view controller) of application. This causes all problems. I can use camera in first page with the same code, but not after that.

There is no problem in first page even if the orientation is landscape. I have set my view size 480*320 in first view controller and same size in all remaining views.

I have removed status bar from my application. I am able to open camera with or without status bar from first view. But it will not work in any other view.

So,plz help if you have any idea about this...

A: 

Did you ever find a solution for this issue?

Shawn
A: 

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