iphone - 发件人地址的 MFMailComposeViewController 问题
<p><p>我使用以下代码发送邮件:</p>
<pre><code>- (IBAction)sendMailPressed:(id)sender
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
// We must always check whether the current device is configured for sending emails
if ()
{
;
}
else
{
;
}
}
else
{
;
}
}
// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [ init];
picker.mailComposeDelegate = self;
;
// Attach pdf to the email
NSURL *urlToLoad = [ URLForResource:self.strSorce withExtension:self.strExtention];
NSData *myData = ;
];
//;
[ pushModalViewController:picker whereCurrentController:self animated:YES];
;
}
// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultSaved:
break;
case MFMailComposeResultSent:
break;
case MFMailComposeResultFailed:
break;
default:
break;
}
[ popModalViewControllerAnimated:YES];
}
// Launches the Mail application on the device.
-(void)launchMailAppOnDevice
{
NSString *recipients = ;
NSString *email = ;
email = ;
[ openURL:];
}
</code></pre>
<p>我得到了这样的观点:
<img src="/image/1sG0E.png" alt="enter image description here"/> </p>
<p>但我需要这个 View (请只注意From字符串,不要注意图像)。</p>
<p>我不知道如何让 From 字符串出现</p>
<p> <img src="/image/t4qrY.png" alt="enter image description here"/> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以在代码中为此使用 <code>setCcRecipients:</code>。</p></p>
<p style="font-size: 20px;">关于iphone - 发件人地址的 MFMailComposeViewController 问题,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/14155897/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/14155897/
</a>
</p>
页:
[1]