当用户按下“发送照片”按钮时,我正在尝试发送一封带有 UIImage 作为附件的自动电子邮件。有什么方法可以让我们以编程方式调用 MFMailComposeViewController 中的“发送”按钮。如果不能,请您建议我使用其他方法。任何帮助将不胜感激。
提前谢谢。
当用户按下“发送照片”按钮时,我正在尝试发送一封带有 UIImage 作为附件的自动电子邮件。有什么方法可以让我们以编程方式调用 MFMailComposeViewController 中的“发送”按钮。如果不能,请您建议我使用其他方法。任何帮助将不胜感激。
提前谢谢。
Apple 可能会拒绝您为此提交的内容,但如果您真的想这样做,方法如下:
-(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 秒,然后发送电子邮件。快乐的黑客:)