2011-08-15 26 views
1

後,我想有一個電子郵件的對話顯示出來的人選擇通過的UIImagePickerController了一張照片後。之後我無法直接彈出。難道我做錯了什麼?最終我會把這張照片作爲附件,但那不是最困難的部分。我可以將電子郵件和照片模式單獨顯示,而不是按順序自動顯示。謝謝!一個電話直接MFMailComposeViewController的UIImagePickerController

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 
// Hide the dialouge 
[picker dismissModalViewControllerAnimated:YES]; 
[self becomeFirstResponder]; 

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; 
controller.mailComposeDelegate = self; 
[controller setSubject:@"test"]; 
[controller setMessageBody:@"test" isHTML:NO]; 

[self presentModalViewController:controller animated:YES]; 

}

回答

1

因爲使用動畫來隱藏自己的圖片選擇。

的的UIImagePickerController當你想展示你的MFMailComposeViewController實際上不被解僱,這就是爲什麼你得到一個錯誤。

你可以改變你的代碼

[picker dismissModalViewControllerAnimated:YES]; 

[picker dismissModalViewControllerAnimated:NO]; // (set Animated to "NO") 

來解決此問題。

P.S.我也不確定你爲什麼加入

[self becomeFirstResponder]; 

那裏,但似乎沒有必要。

+0

你是冠軍。這麼簡單。謝謝 – user634944