【发布时间】:2017-11-14 03:37:47
【问题描述】:
我想在我的电子邮件中集成一个按钮,这样当用户从桌面浏览器单击它时,该按钮会在浏览器本身中打开。
如果用户从移动设备上查看它,应该在应用程序中打开。
我该怎么做?
【问题讨论】:
-
mailt0:
也适用于 android
我想在我的电子邮件中集成一个按钮,这样当用户从桌面浏览器单击它时,该按钮会在浏览器本身中打开。
如果用户从移动设备上查看它,应该在应用程序中打开。
我该怎么做?
【问题讨论】:
你可以试试这个: 不要忘记声明它的委托。
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController * emailController = [[MFMailComposeViewController alloc] init];
emailController.mailComposeDelegate = self;
[emailController setSubject:subject];
[emailController setMessageBody:mailBody isHTML:YES];
[emailController setToRecipients:recipients];
[self presentViewController:emailController animated:YES completion:nil];
[emailController release];
}
// Show error if no mail account is active
else {
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You must have a mail account in order to send an email" delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"OK") otherButtonTitles:nil];
[alertView show];
[alertView release];
}
【讨论】: