【发布时间】:2010-09-30 05:57:11
【问题描述】:
我在 UIViewController 上使用 presentModalViewController 呈现 MFMailComposeViewController(mailController),在 mailController(MFMailComposeViewController 的子类) 类中,我将 shouldAutorotateToInterfaceOrientation 覆盖为
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
但在我的 UIViewController 类中,我将 shouldAutorotateToInterfaceOrientation 隐藏为(这是我的项目需要)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
在展示我的邮件控制器后,如果我旋转设备,它在 iPhone 中可以正常工作(支持横向左/右方向)...但相同的代码在 iPad 中不起作用。我在这里做错了吗?是苹果的bug吗?
我正在使用此 API 进行演示
[myViewController presentModalViewController:mailController animated:YES];
我在 iPhone 和 iPad 上都收到了这个警告视图控制器 <UINavigationController: 0x7720920> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
谢谢,
【问题讨论】:
标签: iphone cocoa-touch ipad uiviewcontroller