Cha*_* SP 1 iphone cocoa-touch uiviewcontroller ipad
我对我的UIViewController呈现使用presentModalViewController MFMailComposeViewController(mailController),在mailController(MFMailComposeViewController的子类)类我有overhide shouldAutorotateToInterfaceOrientation为
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
但是在我的UIViewController类中,我已经过度隐藏了shouldAutorotateToInterfaceOrientation(这是我的项目需要)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return NO;
}
Run Code Online (Sandbox Code Playgroud)
提出我mailcontroller后,如果我旋转设备它完全如预期在iPhone(支持landscapeleft /右方向)...但相同的代码是不是在iPad上运行.我在这里做错了吗?这是苹果虫吗?
我正在使用这个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.
谢谢,
你实际上说的是"我不支持任何方向",这当然......不是真的.
您应该至少在一个方向返回true.例如:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Run Code Online (Sandbox Code Playgroud)