簡體   English   中英

顯示MFMailComposeViewController模態視圖時出現問題

[英]Problem displaying MFMailComposeViewController modal view

我在顯示用於發送電子郵件的模態視圖(MFMailComposeViewController)時遇到問題。 我正在嘗試通過在初始表視圖中選擇一個單元格來從被推入堆棧的詳細視圖中顯示此模式視圖。 我的問題是,盡管確實顯示了MFMailComposeViewController,但我沒有獲得通常與MFMailComposeViewController視圖一起使用的“發送”和“取消”按鈕。 我只是在導航欄中看到詳細信息視圖的“返回”按鈕。

我的詳細信息視圖是UIViewController的子類,該子類符合MFMailComposeViewControllerDelegate,UINavigationControllerDelegate協議:

我發送電子郵件的方法是:

-(void)sendEmail {

   MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
   mailComposer.mailComposeDelegate = self;

   if ([MFMailComposeViewController canSendMail]) {

      [mailComposer setToRecipients:[NSArray arrayWithObjects:@"test@gmail.com",nil]];
      [mailComposer setSubject:@"Subjecy"];
      [mailComposer setMessageBody:@"Body" isHTML:NO];

      [self presentModalViewController:mailComposer animated:YES];
}

     [mailComposer release];
}


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{
     [self dismissModalViewControllerAnimated:YES];

     if (result == MFMailComposeResultFailed) {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message Failed" message:@"Your message failed to send" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
          [alert show];
          [alert release];
    }
}

非常感謝您的幫助。

當使用[self presentModalViewController:mailComposer animation:YES]在iPad上顯示電子郵件窗口時,我遇到了類似的問題。

因為整個窗口向上移動了大約20或30像素,所以發送和取消按鈕被部分切除。 奇怪的是,這僅在“主頁”按鈕位於底部時以“縱向”模式發生。

解決的方法是在MainWindow.XIB中將主窗口大小設置為iPad Full Screen。默認情況下將其設置為None。

豐富

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM