我的应用程序是在横向模式.当我通过Present模型视图调用MFMailComposeViewController时,它来自横向mod.I旋转设备和MFMailComposeViewController视图转到纵向模式我想要限制此旋转它应该始终只在横向模式中.是否有任何这样做的方式..
对MFMailComposeViewController类进行子类化,以便您可以覆盖其shouldAutorotateToInterfaceOrientation以显示它,但是您喜欢:
@interface MailCompose : MFMailComposeViewController {
}
@end
@implementation MailCompose
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
@end
Run Code Online (Sandbox Code Playgroud)
指定新类来代替MFMailComposeViewController:
MailCompose *controller = [[MailCompose alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"In app email..."];
[controller setMessageBody:@"...email body." isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5095 次 |
| 最近记录: |