iPhone SDK - How to display a photo taken with the camera inside a UINavigationController?
- by dan
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?