iPad 中的 UIViewController 方向问题

发布于 2024-09-15 07:19:35 字数 811 浏览 2 评论 0原文

我将 MFMailComposeViewController 作为添加到导航堆栈的视图控制器(让我们称之为 xyz)的模式呈现。当用户单击取消按钮时,MFMailComposeViewController 将被关闭。当 xyz 以纵向/横向模式添加到导航堆栈并且设备方向在单击“取消”之后才会更改时,此功能可以正常工作。

显示模式 - 在按钮点击上分配 init MFMailComposeViewController

[self.navigationController presentModalViewController:mailController animated:NO];

关闭模式 - mailComposeController: didFinishWithResult: error

[self.navigationController dismissModalViewControllerAnimated:YES];

如果在显示 xyz 和取消邮件视图控制器之间方向发生变化,则 xyz 的方向会意外更改。

例如:

  1. 设备方向纵向
  2. PushViewController xyz 按钮点击
  3. 将设备方向更改为横向,所有视图均按预期旋转
  4. 当前 MFMailComposeViewController
  5. 邮件控制器显示在横向模式上
  6. 点击取消或发送电子邮件
  7. xyz 方向旋转 90 度(意外) - 预期:xyz 方向不应该改变。

我不知道发生了什么事。任何帮助表示赞赏。

I am presenting MFMailComposeViewController as modal from a view controller (lets call it xyz) added to nav stack. When user clicks on cancel button, the MFMailComposeViewController is dismissed. This works fine when xyz is added to nav stack in portrait/landscape mode and the device orientation doesn't change until after cancel is clicked.

present modal - alloc init MFMailComposeViewController on a button tap

[self.navigationController presentModalViewController:mailController animated:NO];

dismiss modal - mailComposeController: didFinishWithResult: error

[self.navigationController dismissModalViewControllerAnimated:YES];

If orientation changes between xyz being displayed and the mail view controller canceled, xyz's orientation changes unexpectedly.

For example:

  1. Device orientation portrait
  2. pushViewController xyz on button tap
  3. change device orientation to landscape, all views are rotated as expected
  4. present MFMailComposeViewController
  5. mail controller displayed on landscape mode
  6. tap on cancel or send email
  7. xyz orientation rotated 90 degrees (unexpected) - expected: xyz orientation shouldn't change.

I don't know what's going on. Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文