'Page' modal view controller strange behaviour after presenting 'Full screen' view controller from it
Originator: | vitalys | ||
Number: | rdar://15949644 | Date Originated: | 30-Jan-2014 |
Status: | Open | Resolved: | |
Product: | iOS | Product Version: | iOS 7.x |
Classification: | Reproducible: | Always |
Summary: My iPad application opens modal view controller with 'Page' presentation style. As you know 'Page' presentation style doesn't cover status bar of presenting view controller to indicate page presentation. From the modal view controller the app opens UIImagePickerController to make photo. UIImagePickerController has 'Full screen' presentation style. After dismissing image picker presenting modal view controller become 20px taller and overlaps status bar of the initial view controller. I tried to replace UIImagePickerController with simple UINavigationController and it breaks my modal view controller too. I used such weird code to solve my problem: #define STATUS_BAR_HEIGHT 20 #define IPAD_PORTRAIT_HEIGHT 1004 #define IPAD_LANDSCAPE_HEIGHT 748 UIView *superview = nil; // In case of this view controller included in navigationController we have to use superview of navigation's controller view if (self.navigationController) superview = self.navigationController.view.superview; else superview = self.view.superview; CGRect r = superview.frame; // Sometimes we have to fix height + origin, sometimes only height (becase view has bottom magnifying) // In landscape orientation we have to fix 'width' instead of 'height', because that view controller always works in 'portrait' mode if (self.interfaceOrientation == UIInterfaceOrientationPortrait && r.size.height > IPAD_PORTRAIT_HEIGHT) { r.origin.y = STATUS_BAR_HEIGHT; r.size.height = IPAD_PORTRAIT_HEIGHT; } else if (self.interfaceOrientation == UIInterfaceOrientationMaskPortraitUpsideDown && r.size.height > IPAD_PORTRAIT_HEIGHT) { r.size.height = IPAD_PORTRAIT_HEIGHT; } else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft && r.size.width > IPAD_LANDSCAPE_HEIGHT) { r.size.width = IPAD_LANDSCAPE_HEIGHT; r.origin.x = STATUS_BAR_HEIGHT; } else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight && r.size.width > IPAD_LANDSCAPE_HEIGHT) { r.size.width = IPAD_LANDSCAPE_HEIGHT; } superview.frame = r; Steps to Reproduce: 1) Create iPad project 2) Present 'Page' modal view controller from initial view controller 3) Present 'Full screen' modal view controller from 'Page' modal view controller 4) Dismiss 'Full screen' modal view controller Expected Results: 'Page' modal view controller remains at the same place Actual Results: 'Page' modal view controller shifts 20px up Version: It's reproducible on any iOS7 real iPad or iPad simulator Stackoverflow link: http://stackoverflow.com/questions/21146801/ipad-ios7-page-modal-view-controller-strange-behaviour-after-presenting-full
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!