iPhone SDK - How to display a photo taken with the camera inside a UINavigationController?

Posted by dan on Stack Overflow See other posts from Stack Overflow or by dan
Published on 2010-02-17T14:38:06Z Indexed on 2010/12/26 6:53 UTC
Read the original article Hit count: 211

This is my code so far:

/* class: myViewController
@interface myViewController: UIViewController
       <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
*/
- (IBAction) getPicture {
    UIImagePickerController * picker = [[UIImagePickerController alloc] init];
       picker.delegate = self;
       picker.sourceType = UIImagePickerControllerSourceTypeCamera;
       [self presentModalViewController:picker animated:YES];
}

- (void) imagePickerController:(UIImagePickerController *)thePicker 
                    didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo
{
    [[thePicker parentViewController] dismissModalViewControllerAnimated:YES];
       UIImage *img = [imageInfo
                           objectForKey:@"UIImagePickerControllerOriginalImage"];
    self.myImageView.image = img;
}

So basically I'm trying to get a photo from the iPhone camera and display it in a UIImageView. This works perfectly fine as long the class myViewController is displayed as a standalone view. If I'm putting the View inside a UINavigationController the UIImageView won't display the image after taking one with the camera. But if I choose a picture from the library everything is fine again.

So why does the UIImageView won't display a image taken with the camera inside a UINavigationController?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uinavigationcontroller