问题
We have an ipad application, that supports landsace right and left orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
We are showing view controllers as modal view by calling
childController.modalPresentationStyle = UIModalPresentationPageSheet;
childController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[parentController presentViewController:childController animated:childController.animated completion:^{
childController->isBeingShowed = FALSE;
When we are showing one modal view: RootViewController(FullScreen)->SelectOption(500, 500) rotation works fine and select options view controller has it's original size.
When we are showing additional modal view: RootViewController(FullScreen)->SelectOption(500, 500)->Additional options(300, 300), after rotation SelectOption view controller size changed to full screen while AdditionalOptions view controller keeps it's size as was specified.
回答1:
The problem was solved with small trick.
The root of them problem, was that i'm opening first modal view as PageSheet, when i'm opening second modal view from first one i got MainView(FullScreen), modal view opened as page sheet, and second page sheet opened from previous page sheet. This architecture caused problems with rotation.
Trick: now i'm opening second modal view as FormSheet with recalculating coordinates to correspond PageSheet coordinate system. So now it looks like this MainView->PageSheet->FormSheet and the problem was fixed.
Sorry that without the code.
来源:https://stackoverflow.com/questions/12599621/ios-6-incorrect-modal-view-size-after-rotation