【问题标题】:Presenting UIModalViews in landscape mode以横向模式呈现 UIModalViews
【发布时间】:2023-03-25 16:43:01
【问题描述】:

我正在尝试在我的 iPad 应用程序中显示一些 UIModalFormSheets。它工作没有任何问题,除了一件事:

当我的 iPad 处于横向模式时,我的模式表单正在移动到屏幕的中心,然后 会旋转到适当的角度。我想要的只是根据视图模式(纵向或横向)以直角呈现模态表单,在显示之前,这样用户就不会看到这种旋转。

我已经尝试了modalTransitionStylemodalPresentationStyle 的所有模式,但似乎没有什么能阻止模式表单在显示后旋转。

这就是我正在做的:

NewFavouriteSheet *newFavouriteSheet = [[NewFavouriteSheet alloc] 
                 initWithNibName:@"NewFavouriteSheet" bundle:nil];
newFavouriteSheet.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:newFavouriteSheet animated:NO];

有人对如何以正确的方式显示模态视图有建议吗?

感谢您的帮助。

【问题讨论】:

    标签: cocoa-touch rotation modal-dialog uimodalpresentationformsh


    【解决方案1】:

    确保模式表中的每个视图控制器都对横向方向的shouldAutorotateToUserInterfaceOrientation: 做出适当的响应。

    【讨论】:

      猜你喜欢
      • 2014-09-23
      • 2017-04-25
      • 2011-09-27
      • 1970-01-01
      • 2012-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多