UIImagePickerController in popover broken on iOS 9
UIImagePickerController in popover broken on iOS 9
- Subject: UIImagePickerController in popover broken on iOS 9
- From: Matt Reagan <email@hidden>
- Date: Wed, 04 May 2016 11:34:35 -0700
Hi all,
I've encountered a bug when UIImagePickerController is presented in a popover on iOS 9, and have been unable to find a workaround / fix.
It is easily reproducible in a brand new Xcode template (repro steps + sample project linked below), but I haven't been able to find much information online. I've been able to find partial fixes that depend on the orientation + multitasking settings of the app, but when the UIImagePickerController is the child of any other view controller (UITabBarController etc.) and the device or sim is in Landscape, it always breaks. I'm attempting to find a reliable fix or workaround, was hoping someone here may have seen this before?
Bug:
* UIImagePickerController presented in a popover of any kind has a broken 'pop' / back navigation animation
* Animated gif: http://i.imgur.com/na2lprb.gif
Factors:
* The bug itself is impacted by several things:
- Orientation of the device/sim (only reproducible in Landscape)
- Multitasking availability (only Multitasking-capable devices/sims AFAICT)
- Multitasking opt-in (whether 'Requires full screen' is checked)
- Whether the UIImagePickerController is a child of any other controller
* The bug is NOT impacted by the following:
- Whether UIPopoverController or presentViewController: + UIModalPresentationPopover style is used
Repro steps (sample project linked below):
- Create a new iOS Xcode project ('Single view application' template)
- Add a button and wire it up to an action method in ViewController.m
- Add code to present a standard UIImagePickerController in a UITabBarController (ex. snippet below)
- Run the app on a 9.3 iPad Air 2 Device (or simulator)
- Make sure device/sim is rotated to Landscape
- Tap button (see 'Result' below)
Result:
* The popover is presented in the UITabBarController + popover normally, but if the user pushes back within the UIImagePickerController's navigation flow, the animation is broken
* Gif: http://i.imgur.com/na2lprb.gif
Example code:
//**** Bug also reproducible via presentViewController: + UIModalPresentationPopover style
- (IBAction)buttonWasTapped:(UIButton *)sender
{
UIImagePickerController *cameraRollController = [UIImagePickerController new];
cameraRollController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
cameraRollController.allowsEditing = NO;
UITabBarController *tabController = [UITabBarController new];
tabController.viewControllers = @[cameraRollController];
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:tabController];
[popoverController presentPopoverFromRect:sender.bounds
inView:sender
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
}
Example project:
* http://sound-of-silence.com/sos/private/ImagePickerBug.zip
So far I've tried just about everything I can think of to fix the problem. As noted above, there are partial "fixes" that work (disabling Multitasking, or limiting orientations), but this is true only when the UIImagePickerController is presented _directly_ in the popover. When the picker is a child of any other view controller (embedded in a tab controller, or added as a child of an arbitrary UIViewController) I've been unable to find a fix.
Has anyone seen this before? Any advice/suggestions would be greatly appreciated.
Thank you~
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden