2013-06-01 1 views
-1

아이폰 앱에서 이메일을 보내고 있습니다. 사용자가 클릭 한 후 이메일의 버튼을 클릭하면 test() 메소드를 호출해야합니다. 다음 코드를 사용하고 있습니다.iphone 앱에서 이메일을 보내는 동안 보내기 버튼을 누른 채로 메서드를 호출하는 방법

NSString * emailBody [email protected]"<html><body>Thank you for your participation in Consulting<br>Practitioner and Client Program.</br><br>Attached is the copy of your signed contract for your records<p>Please email or fax your completed W-9 form to<br>our PEI Support Team<br>Email:[email protected]<br>Fax:800-741-1310<body></html>"; 



[picker setMessageBody:emailBody isHTML:YES]; 





[self.navigationController presentViewController:picker animated:YES completion:nil]; 




} 

} 


[self test];  

}

+0

시험() - 방법 .. 의미에서? U는 메일 확인이나 귀하의 방법이 필요합니다 ..? –

답변

0

이 위임 방법을 implemente보십시오? 작곡가가 사용자에 의해 종료 된 후에 호출됩니다.

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { 
    NSString *message = @""; 
    // Notifies users about errors associated with the interface 
    switch (result) { 
     case MFMailComposeResultCancelled: 
      message = @"Mail: canceled"; 
      break; 
     case MFMailComposeResultSaved: 
      message = @"Mail: saved"; 
      break; 
     case MFMailComposeResultSent: 
      message = @"Mail: sent"; 
//------- call your test method here 
      break; 
     case MFMailComposeResultFailed: 
      message = @"Mail: failed"; 
      break; 
     default: 
      message = @"Mail: not sent"; 
      break; 
    } 
    [self dismissModalViewControllerAnimated:YES]; 
    } 
+0

이 메서드를 호출하는 방법 –

+0

그것은 대리자 메서드입니다. 그래서 자동으로 호출됩니다. –

+0

이것은 시뮬레이터에서 작동하지 않습니다. 그래서 장치에서 사용하려고합니다. –

관련 문제