Oliver
Oliver

Reputation: 23550

iPhone - Showing a UIImagePickerController

I've searched some ways to use a UIImagePickerController in my app, adn the only one I found that worked was the following :

On the first View shown by the app, put :

self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    self.picker.showsCameraControls = NO;
    self.picker.navigationBarHidden = YES;
    self.picker.wantsFullScreenLayout = YES;

    // Insert the overlay
    self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
    self.picker.cameraOverlayView = self.overlay.view;

    [self presentModalViewController:self.picker animated:NO];

Do you know another (allowed by Apple) way to include such a camera control into a view without having to call presentModalViewController ?

Upvotes: 2

Views: 604

Answers (2)

user349819
user349819

Reputation:

No. As of 4.3, any other method requires using private (not allowed) api's.

In case you were interested in how you would do using private api's.

http://onlamp.com/pub/a/onlamp/2008/03/25/the-apple-sdk-apis-apple-didnt-want-you-to-know-about.html

Upvotes: 0

TechZen
TechZen

Reputation: 64428

The UIImagePickerController is itself a view controller and for obvious reason must operate modally.

If you are having trouble using it based on the code above, the most likely problem is that you have not assigned a delegate to the picker so that when it completes you receive no message and can't access the results.

Assign a delegate for smooth operation of the picker.

Upvotes: 2

Related Questions