How to add more message in MFMailComposeViewController
I开发者_如何学编程 am working on an app in which user have to send an email, i have implemented the email functionality and it is working, however the only thing which i need to do is to write multiple message in message body. i have used the code below to write multiple message
[mailController setMessageBody:@"Hey" isHTML:YES];
[mailController setMessageBody:delegate.tripName isHTML:YES];
[mailController setMessageBody:delegate.resultString isHTML:YES];
[mailController setMessageBody:delegate.messageDetails isHTML:YES];
However only the last message is only showing in the mail, how to show all the message in the mail, in separate line
You are setting the message again and again with the different message.
First you need to construct an string object then append all your string and set that as message. Go with the below approach.
NSMutableString* message = [[NSMutableString alloc] initWithCapacity:4];
[message appendString:@"Hey"];
[message appendString:delegate.tripName];
[message appendString:delegate.resultString];
[message appendString:delegate.messageDetails];
[mailController setMessageBody:message isHTML:YES];
[message release];
message = nil;
NSString *temp =[NSString stringWithFormat:@"%@%@%@%@%@%@%@",@"Hey",@"\n",delegate.tripName,@"\n",delegate.resultString,@"\n",delegate.messageDetails];
[mailController setMessageBody:temp isHTML:YES];
精彩评论