How does one make the camera on the iphone appear from the app delegate? Is it possible?

Posted by K-RAN on Stack Overflow See other posts from Stack Overflow or by K-RAN
Published on 2010-06-11T16:37:58Z Indexed on 2010/06/11 17:23 UTC
Read the original article Hit count: 211

I'm just playing around with a simple program that opens the camera. That's literally all that I want to do. I'm a beginner and I believe that I have the basics down in terms of UI management for the iPhone so I decided to give this one a whirl.

What I'm trying to do right now is...

- (BOOL) application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) launchOptions
{
    UIImagePickerController * camera = [[UIImagePickerController alloc] init];
    camera.delegate = self;
    camera.sourceType = UIImagePickerControllerSourceTypeCamera;
    camera.allowsEditing = NO;
    camera.showsCameraControls = NO;
    [viewController presentModalViewController:camera animated:NO];

    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

return YES:
}

So basically, initialize the camera, set some things and show it in the main view. I set the camera's delegate to self because this code is placed in the delegate class (and yes, the delegate class is conforming to UIImagePickerControllerDelegate && UINavigationControllerDelegate).

Main problem right now is that nothing is appearing on the screen. I have absolutely no idea what I'm doing wrong, especially since the program is building correctly with no errors or warnings...

Any help is appreciated! Thanks a lot :D

© Stack Overflow or respective owner

Related posts about iphone

Related posts about camera