UIImagePickerView in camera mode displays all black on the turned off ViewController screen on iPad

I have an application that uses UIImagePickerView to allow the user to either take a picture with their camera or select one of the camera’s clips using UIImagePickerView.

After receiving the image, I present another dialog box above the collector using [picker presentViewController:myViewController animated:YES completion:nil] .

If I run the application as an iPhone application (on my iPad) when I reject myViewController using [myviewController.presentingViewController dismissViewControllerAnimated:YES completion:nil] , it returns to showing CameraRoll or CameraFeed to make another image.

But on the iPad, if I select a picture, it works, but if I take a picture with the camera, I just get a black screen.

Any idea why?

+6
source share
3 answers

On the iPad, when you use sources other than the camera feed, you present the UIImagePickerController in a popover, and you can use it as much as you like. But when you decide to select the source of UIImagePickerControllerSourceTypeCamera , the selection window displays full screen, and you have two cases:

  • If you use your own controls (showCameraControls = NO), you can take as many images as you want with the same controller.
  • If you use the default controls (showCameraControls = YES), after taking ONE picture, you MUST scatter the controller because it is not applicable again, and I think this is your business. You put the next controller on the stack after taking a photo, after that you try to return to your controller of choice, but it is unusable and you can see a black screen.

Apple docs for imagePickerController:didFinishPickingMediaWithInfo: ::

If you have determined that the CameraControls property for NO is displayed for image selection and provide your own controls, you can take several pictures before dismissing the image selection interface. However, if you set the YES property, your delegate must reject the image selection interface after the user takes one image or cancels the operation.

If you want to make another image, in this case you need to go back to the base controller and create an instance of UIImagePickerController again.

Hope this helps.

Edit: The easiest way IMO can rebuild your checkpoint controller is to remove the collector after shooting without animation and then show the next controller with animation. This will give the user the feeling that the next controller is displayed immediately after the selection controller without “blinking”.

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [self dismissViewControllerAnimated:NO completion:^{ [self presentViewController:<newController> animated:YES completion:nil]; }]; } 
+6
source

You can try to remove UIImagePicker normally, and when the Pre-viwer View Controller activates viewWillDesapear, you “tell” the previous viewController that when it sees WAAppear, it again shows UIImagePicker. I think it works.

+1
source

I had a similar problem in the application. I ended up presenting the image picker for the camera in the popover controller, not for the iPad. I'm not sure if this will work for your application, but this is a different approach. I had no problems with this and I liked it a lot better.

+1
source

All Articles