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.
There are screen shots:
They only way to restore size of 'Page' view controller is changing height of viewController.view.superview.superview.superview.superview
frame after returning to 'Page' view controller. But it's really weird.
Is there another way to fix 'Page' modal view controller presentation after dismissing nested modal view controller?
UPDATE: 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;
I don't believe that there is no more elegant solution. Any ideas how to improve it?
UPDATE2: I've just opened a bug. You can follow it there: rdar://15949644
UPDATE3: There is my sample project: link