2010-03-29 5 views
1

사용자가 '사진 보내기'단추를 누를 때 첨부 파일로 UIImage가 포함 된 자동 전자 메일을 보내려고합니다. MFMailComposeViewController에서 "보내기"단추를 프로그래밍 방식으로 호출 할 수있는 방법이 있습니까? 그렇지 않다면 제게이 일을하는 다른 방법을 제안 해주십시오. 도움이 될 것입니다.MFMailComposeViewController 프로그래밍 방식으로 "보내기"단추를 호출합니다.

고지.

+2

MFMailComposeViewController에 대한 문서는 매우 구체적으로 말합니다. 메일 교환기에 직접 연결하여 직접 보내거나 작성한 일부 서버로 데이터를 보낸 다음 거기에서 메일을 보내야합니다. –

답변

6

애플은 이에 대한 제출을 거부하지만, 당신이 정말로 싶어 그것을 할 경우, 여기 방법은 있습니다

-(void)showController { 
    MFMailComposeViewController *mailController; 
    //alloc, init, set properties, do whatever you normally would 
    [self.navigationController presentModalViewController:mailController animated:YES]; 
    [mailController release]; 

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(hackMail:) userInfo:mailController repeats:NO]; 
} 

-(void)hackMail:(NSTimer*)theTimer { 
    MFMailComposeViewController *mailController = theTimer.userInfo; 
    UIBarButtonItem *sendBtn = mailController.navigationBar.topItem.rightBarButtonItem; 
    id targ = sendBtn.target; 
    [targ performSelector:sendBtn.action withObject:sendBtn]; 
} 

이것은, 메일 컨트롤러를 보여 3 초 기다린 다음 전자 메일을 보냅니다. 행복한 해킹 :)

+0

누군가가 이것을 거절 했습니까? – coder

+0

iOS6에서 작동하지 않습니다. –

+0

iOS 7에서 작동하지 않습니다. –

관련 문제