我正在使用 MFMailComposeViewController 作为应用内电子邮件,它在纵向模式下工作正常。但是当我的支持两种方向的应用程序处于横向模式时, 使用 [self presentModalViewController:mailVC 动画:YES];
强制我的整个应用程序进入我不想要的纵向模式。
我尝试了很多方法,包括重写 MFMailComposeViewController shouldAutorotateToInterfaceOrientation: 方法、放弃第一响应者等等,但运气不佳。
如何让 MFMailComposeViewController 在 iPad 上的横向模式下工作?
最佳答案
我遇到了同样的问题并尝试覆盖,但这对我没有帮助。
尝试将“presentModalViewController:”发送到应用程序窗口的 rootViewController(在 AppDelegate 中)。
我认为这对我有用,因为 MFMailComposeViewController 无法强制 rootViewController 方向,但可以强制由 rootViewController 的 navigationController 推送的 viewController 方向。
你需要这样的东西:
[((AppDelegate *)[UIApplication sharedApplication]).window.rootViewController presentViewController:mailVC animated:YES completion:nil];
关于iphone - MFMailComposeViewController 在 iPad 上强制纵向方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4721722/