4th*_*ace 5 cocoa-touch uiviewcontroller iphone-sdk-3.0
我的应用是基于景观的.我想在横向上使用MFMailComposeViewController但是找不到任何关于方向的信息.在横向中,MFMailComposeViewController仅在横向显示邮件撰写窗口的顶部,从左侧进入.基本上它覆盖了一半的景观屏幕.有没有办法让邮件撰写窗口以横向而不是纵向显示?
---编辑---我想加载邮件撰写的视图是这样派生的:
//from first UIViewController
[self presentModalViewController:secondView animated:YES];
//from secondView (a UIViewController), I load the info view, which is where the mail compose shows
InfoController *infoController = [[InfoController alloc] initWithNibName:@"Info" bundle:[NSBundle mainBundle]];
[self.view addSubview:infoController.view];
Run Code Online (Sandbox Code Playgroud)
从上面可以看出,邮件撰写父视图是第三个加载的.在info.plist中,我这样做:
UIInterfaceOrientation = UIInterfaceOrientationLandscapeRight
Run Code Online (Sandbox Code Playgroud)
我们可以在Application Delegate类实现中添加以下代码,以覆盖邮件编辑器视图控制器的自动轮换.
@interface MFMailComposeViewController (AutoRotation)
// to stop auto rotation
@end
@implementation MFMailComposeViewController (AutoRotation)
// stop auto rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// should support all interface orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
Run Code Online (Sandbox Code Playgroud)
如果在嵌套的UIViewController上显示MailViewController,请尝试在主UIViewController上显示它.这解决了我的问题.我刚把主控制器传递给主控制器.
| 归档时间: |
|
| 查看次数: |
6090 次 |
| 最近记录: |