gpt4 book ai didi

MFMailComposeViewController 在横向

转载 作者:行者123 更新时间:2023-12-01 09:10:27 25 4
gpt4 key购买 nike

我的应用程序处于横向模式。当我通过当前模型 View 调用 MFMailComposeViewController 时,它进入横向模式。我旋转设备并且 MFMailComposeViewController View 进入纵向模式我想限制这种旋转它应该始终只在横向模式中。有什么办法吗..

最佳答案

子类化 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

指定新类代替 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];

关于MFMailComposeViewController 在横向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1518499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com