I have an application which uses a UIImagePickerView to allow the user to either take a picture with their camera or select one from the camera roll using the UIImagePickerView.
After getting a picture, I present a different dialog on top of the picker using [picker presentViewController:myViewController animated:YES completion:nil]
.
If I run my app as an iPhone app (on my iPad), when I dismiss myViewController
using [myviewController.presentingViewController dismissViewControllerAnimated:YES completion:nil]
it goes back to either showing the CameraRoll or the CameraFeed to take another picture.
But on the iPad, if I am selecting a picture, it works, but if I am taking a picture using the camera feed, I just get a black screen.
Any idea why?
On iPad when you are using sources different than camera feed, you are presenting UIImagePickerController in a popover and you can use it as long as you wish. But when you decide to pick up the source UIImagePickerControllerSourceTypeCamera
the picker window is presenting full screen and you have two cases:
Apple docs for imagePickerController:didFinishPickingMediaWithInfo:
:
If you set the image picker’s showsCameraControls property to NO and provide your own custom controls, you can take multiple pictures before dismissing the image picker interface. However, if you set that property to YES, your delegate must dismiss the image picker interface after the user takes one picture or cancels the operation.
If you want to take another picture in this case you have to go back to your base controller and create the UIImagePickerController instance one more.
I hope this will help.
Edit: The easiest way IMO to rebuild your view controllers stack is to dismiss the picker after taking a photo without animation and after that show the next controller with animation. It will give the user feeling, that the next controller is displayed just after the picker controller without any "flashing".
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:NO completion:^{
[self presentViewController:<newController> animated:YES completion:nil];
}];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With