与iPad与iOS6的,我们有这个bug,其中一个模式视图控制器将扩大到全屏,即使它被告知要使用“格式表”的演讲风格。 但是,这种情况只是如果有两个情态动词,一个父一个和它的孩子。
因此,这是怎样的第一模式创建并提交:
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[parentController presentModalViewController:navigationController animated:YES];
// parentController is my application's root controller
这是怎样的孩子模式创建并提交:
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[parentController presentModalViewController:navigationController animated:YES];
// parentController is the navigationController from above
所以,从横向旋转为纵向时,父模式将扩大到全屏,并保持即使我们转回景观的方式。
当我们有父本身(无子模态)模态所有,那么它将按预期工作,这是它仍然在形式上纸方式。
请注意,这发生在iOS6的唯一(设备和仿真器)和iOS 5不会发生(模拟器和报告测试工作)。
到目前为止,我已经尝试没有成功如下:
- 设置
wantsFullScreenLayout
到NO
- 迫使
wantsFullScreenLayout
总是返回NO
通过重写它 - 使导航控制器内部的某些我的控制器还指定
UIModalPresentationFormSheet
- 实施
preferredInterfaceOrientationForPresentation
- 升级到iOS 6.0.1
谢谢!
更新 :所以,我改编自苹果开发者论坛(响应https://devforums.apple.com/message/748486#748486 ),使其与多个嵌套模式的工作原理。
- (BOOL) needNestedModalHack {
return [UIDevice currentDevice].systemVersion.floatValue >= 6;
}
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
// We are the top modal, make to sure that parent modals use our size
if (self.needNestedModalHack && self.presentedViewController == nil && self.presentingViewController) {
for (UIViewController* parent = self.presentingViewController;
parent.presentingViewController;
parent = parent.presentingViewController) {
parent.view.superview.frame = parent.presentedViewController.view.superview.frame;
}
}
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
// We are the top modal, make to sure that parent modals are hidden during transition
if (self.needNestedModalHack && self.presentedViewController == nil && self.presentingViewController) {
for (UIViewController* parent = self.presentingViewController;
parent.presentingViewController;
parent = parent.presentingViewController) {
parent.view.superview.hidden = YES;
}
}
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
// We are the top modal, make to sure that parent modals are shown after animation
if (self.needNestedModalHack && self.presentedViewController == nil && self.presentingViewController) {
for (UIViewController* parent = self.presentingViewController;
parent.presentingViewController;
parent = parent.presentingViewController) {
parent.view.superview.hidden = NO;
}
}
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}