我希望我的应用程序使用MFMailComposeViewController发送电子邮件,以便收件人可以单击嵌入式url打开相应的网站.
MFMailComposeViewController似乎没有明确支持这一点.有任何想法吗?
我想在我的视图中显示邮件ID,以便单击邮件ID应该打开邮件编辑器视图.
我想以下划线显示按钮文本,以显示它是一个超链接,并为按钮单击事件调用邮件编辑器视图.目前,我无法显示下划线的按钮文字.
我想在按钮上方放置一个标签并调整label属性以获得带下划线的文本,但这不起作用.
是否有不同的方式来获得我想要的外观和行为?
iphone hyperlink uibutton uilabel mfmailcomposeviewcontroller
我这里有一个非常奇怪的问题.我正在使用一个现有的模态视图控制器在ViewController上显示我的MFMailComposer ViewController,它放在导航栏中.
[self presentModalViewController:emailviewController animated:YES];
隐藏,我用...
-(void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
一切正常,但当我解散我的MailComposer时,原始视图控制器隐藏在状态栏后面.
我试图使用setFrame方法将视图偏移量修改为10,但它没有用.(这在模态视图控制器出现和解除之前和之后都很累)
我试过暂时隐藏状态栏但没有工作.
我已经尝试过self.navigationcontroller presentmodalviewcontrolle但是这个也没有用...
任何想法或建议将受到高度赞赏

编辑:大多数人给我一个建议手动修改偏移量.那不行.因为如果我在原始viewcontroller方法的viewDidLoad/viewWillapper中执行此操作,那么它会在当前模态视图控制器之前移动我的视图,而在我加载模态视图控制器之后它变得正常.

我有一个存储在Documents Folder中的.txt文件,我希望通过MFMailComposeViewController将其发送到-sendEmail方法体中的下一个代码:
NSData *txtData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"dataBase" ofType:@"txt"]];
[mail addAttachmentData:txtData mimeType:@"text/plain" fileName:[NSString stringWithFormat:@"dataBase.txt"]];
Run Code Online (Sandbox Code Playgroud)
当邮件编辑器出现时,我可以在邮件正文中看到附件,但是我没有附件就收到了这封邮件.也许是.txt附件的MIME类型错误或此代码有问题?
谢谢
xcode objective-c email-attachments ios mfmailcomposeviewcontroller
我遇到了问题 MFMailComposeViewController
我收到了这个错误
viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=... {Message=Service Connection Interrupted}
Run Code Online (Sandbox Code Playgroud)
用这个代码
- (IBAction) mailbutton:(id)sender
{
if([MFMailComposeViewController canSendMail])
{
[MSAPP.globalMailComposer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentViewController:MSAPP.globalMailComposer animated:YES completion:nil];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to mail. No email on this device?"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[MSAPP cycleTheGlobalMailComposer];
}
}
Run Code Online (Sandbox Code Playgroud) 我在做一些蠢事吗?我可以预先填写并发送电子邮件,但在电子邮件中忽略"\ r \n":
- (void) sendEventInEmail
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSString *emailSubject = [eventDictionary objectForKey:EVENT_NAME_KEY];
[picker setSubject:emailSubject];
// Fill out the email body text
NSString *iTunesLink = @"http://itunes.apple.com/gb/app/whats-on-reading/id347859140?mt=8"; // Link to iTune App link
NSString *content = [eventDictionary objectForKey:@"Description"];
NSString *emailBody = [NSString stringWithFormat:@"%@\r\nSent using <a href = '%@'>What's On Reading</a> for the iPhone.", content, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES];
picker.navigationBar.barStyle = UIBarStyleBlack;
[self presentModalViewController:picker animated:YES];
[picker release];
}
Run Code Online (Sandbox Code Playgroud)
问候
戴夫
在我的应用程序中,我使用的是MFMailComposeViewController.我在标题栏中放了一个back和Done按钮.我的标题栏是黑色的,但我有蓝色的按钮背景.如何将按钮背景颜色更改为black彩色?
我使用此块向联系人发送消息,发送后,后退按钮就在那里,但是当我触摸它时没有任何反应.请帮帮我:)
-(IBAction) InviteIt:(id) sender{
if ([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *messageComposer =
[[MFMessageComposeViewController alloc] init];
messageComposer.messageComposeDelegate = self;
NSString *message = @"You have more body buddies than you think at: http://www.itunes.com/app/JoyChain ";
[messageComposer setBody:message];
messageComposer.recipients = [NSArray arrayWithObjects:_itsnum, nil];
messageComposer.messageComposeDelegate = self;
[self presentViewController:messageComposer animated:YES completion:nil];
}
}
Run Code Online (Sandbox Code Playgroud) 目前,我还没有找到一种方法来为iOS 12.0做到这一点.我试过像这样设置条形色调.
[mailController.navigationBar setTintColor:[UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)
然后,我尝试使用以下代码设置标题文本属性
[mailController.navigationController.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor WhiteColor]};
Run Code Online (Sandbox Code Playgroud)
我尝试过在StackOverflow上找到的更多选项,但都没有.我希望有人找到一种可靠的方法来更改导航栏标题文本颜色.无论我做什么,它都会保持黑色.条形按钮的颜色更改正确,但不是导航栏标题.
我试图改变导航栏按钮的颜色,导航栏色调和文本颜色,但我似乎没有得到任何地方.在MFMailComposeViewController正在通过激活UIActivityViewController和我已经试过那些(通过未工作过几种不同的方法UIActivityViewController虽然).
这是我目前的代码:
UINavigationBar.my_appearanceWhenContainedIn(MFMailComposeViewController).barTintColor = UIColor.blackColor()
Run Code Online (Sandbox Code Playgroud)
这是在这里提出的.我也试过这个:
activityVC.navigationController?.navigationBar.tintColor = UIColorFromRGB(0x0096FF)
activityVC.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
Run Code Online (Sandbox Code Playgroud)
我也想改变状态栏的颜色.
有人有主意吗?
更新:
我修复了按钮和标题的导航栏问题,但仍在寻找状态栏的解决方案.这样做不起作用:
self.presentViewController(activityVC, animated: true, completion: { () in
UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
})
Run Code Online (Sandbox Code Playgroud) uinavigationbar ios uiactivityviewcontroller swift mfmailcomposeviewcontroller
mfmailcomposeviewcontroller ×10
ios ×7
objective-c ×5
iphone ×4
xcode ×2
cocoa-touch ×1
hyperlink ×1
ipad ×1
swift ×1
uibutton ×1
uilabel ×1