MFMailComposeViewController在iPad上强制纵向方向 [英] MFMailComposeViewController forces Portrait Orientation on iPad
问题描述
我在应用程序电子邮件中使用MFMailComposeViewController,它在纵向模式下工作正常。但是当我支持两种方向的应用程序都处于横向模式时,
使用[self presentModalViewController:mailVC animated:YES];
I am using MFMailComposeViewController for in app email and it works fine in Portrait mode. But when my app which supports both orientation is in landscape mode, using [self presentModalViewController:mailVC animated:YES];
强制我的整个应用程序进入纵向我不想要的模式。
forces my entire app into the portrait mode which I don't want.
我已经尝试了很多东西来覆盖MFMailComposeViewController shouldAutorotateToInterfaceOrientation:方法,让第一个响应者辞职等等,没有多少运气。
I have tried many things from overriding MFMailComposeViewController shouldAutorotateToInterfaceOrientation: methods, resigning the first responder and so on without much luck.
如何让iPad上的MFMailComposeViewController工作?
How can I get MFMailComposeViewController work in Landscape on iPad ?
推荐答案
我遇到了同样的问题并尝试重写,这对我没有帮助。
I had the same problem and tried overriding, that's didn't help me.
尝试将presentModalViewController:发送到应用程序窗口的rootViewController(在AppDelegate中)。
Try to send "presentModalViewController:" to rootViewController of your application window (in AppDelegate).
我认为这对我有用,因为MFMailComposeViewController不能强制rootViewController方向,但可以强制由rootViewController的navigationController推送的viewControllers的方向。
I think that's works for me because MFMailComposeViewController can't force rootViewController orientation, but can force orientation of viewControllers that was pushed by rootViewController's navigationController.
你需要这样的东西:
[((AppDelegate *)[UIApplication sharedApplication]).window.rootViewController presentViewController:mailVC animated:YES completion:nil];
这篇关于MFMailComposeViewController在iPad上强制纵向方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!