相关疑难解决方法(0)

iOS 6:旋转后忽略父模态的modalPresentationStyle

使用iOS6的iPad,我们有这个错误,即模态视图控制器将扩展到全屏,即使它被告知使用"表单"演示样式.但是,只有当有两个模态,一个父模型及其子模式时,才会发生这种情况.

这就是第一个模态的创建和呈现方式:

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[parentController presentModalViewController:navigationController animated:YES];
// parentController is my application's root controller
Run Code Online (Sandbox Code Playgroud)

这是创建和呈现子模态的方式:

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[parentController presentModalViewController:navigationController animated:YES];
// parentController is the navigationController from above
Run Code Online (Sandbox Code Playgroud)

因此,当从横向旋转到纵向时,即使我们旋转回横向,父模式也会扩展到全屏并保持这种状态.

当我们拥有父模态本身(没有子模态)时,它按预期工作,即它保持在表单样式中.

请注意,这只发生在iOS6(设备和模拟器)上,并且不会发生在iOS 5(模拟器上,并报告由测试人员工作).

到目前为止,我已经尝试了以下但没有成功:

  • 设置wantsFullScreenLayoutNO
  • 强迫wantsFullScreenLayout总是NO通过覆盖它来返回
  • 在导航控制器中确定我的控制器也指定 UIModalPresentationFormSheet
  • 实施 preferredInterfaceOrientationForPresentation
  • 升级到iOS 6.0.1

谢谢!


更新:所以,我调整了Apple开发者论坛(https://devforums.apple.com/message/748486#748486)的响应,以便它可以与多个嵌套模式一起使用.

- (BOOL) needNestedModalHack {
    return [UIDevice currentDevice].systemVersion.floatValue >= 6;
}

- (void) …
Run Code Online (Sandbox Code Playgroud)

modal-dialog rotation ipad ios

33
推荐指数
2
解决办法
5627
查看次数

标签 统计

ios ×1

ipad ×1

modal-dialog ×1

rotation ×1