0
花了一些時間看堆棧溢出的類似問題後,不幸的是沒有人似乎解決了我的問題。MFMailComposeViewController未在橫向模式下打開。但在肖像模式下工作
我使用的是UIActionSheet
,當用戶點擊的動作片發送電子郵件,下面的代碼被稱爲:
if ([MFMailComposeViewController canSendMail]){
NSString *emailTitle = @"bla bla bla";
// Email Content
NSString *messageBody = @"bla bla bla";
// To address
NSArray *toRecipents = [NSArray arrayWithObject:@"[email protected]"];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];
[self.view.window.rootViewController presentViewController:mc animated:YES completion:NULL];
NSLog(@"email view opened");
}
else{
UIAlertView *anAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"No mail account setup on device" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
[anAlert addButtonWithTitle:@"Cancel"];
[anAlert show];
}
MFMailComposeViewController
在縱向模式下打開我的iPhone,但在打開應用程序時在iPad上的橫向模式,沒有任何反應。沒有視圖彈出,什麼也沒有。 它在NSLog
中顯示「電子郵件視圖已打開」,但沒有其他。 想法?
編輯該應用程序是縱向僅適用於iPhone和iPad的
任何方位再次編輯 張望了一下打經過,如果我的代碼分配給一個按鈕,它工作得很好,只有從動作片選擇電子郵件時,這方面的問題目前
可能重複troller不會開始在橫向模式](http://stackoverflow.com/questions/3772016/modal-view-controller-wont-start-in-landscape-mode) – LoVo 2015-03-13 10:41:48
您是否嘗試使用根視圖控制器來呈現它? – Dennis 2015-03-13 10:44:42
@丹尼斯我試過這個使用但沒有區別'[self.view.window.rootViewController presentViewController:mc animated:YES completion:NULL];' – Manesh 2015-03-13 10:49:37