Search code examples
iosobjective-cmfmailcomposeviewcontroller

Objective C: Bold Message Body in MFMailComposeViewController


I have this code

NSString *messageBody = [NSString stringWithFormat:@"Name: %@\nCompany/Institution: %@\nAddress: %@\nCity: %@\nCountry: %@\nContact Number: %@\nE-Mail: %@\n \n \n Message: %@", rName.text, rCompany.text, rAddress.text, rCity.text, rCountry.text, rContactNumber.text, rEmail.text, rDescription.text];
    [tempMailCompose setMessageBody:messageBody isHTML:NO];

to fill contents on the MFMailComposeViewController Now what I want to do is to make the Name, Address, City, Country, Contact Number, E-Mail, and Message to be bold. What I did was to insert <strong> but the result was wrong it also displays <strong>as text.

How will I able to bold it?


Solution

  • Try this

    NSString *messageBody = [NSString stringWithFormat:@"Name: <b>%@</b><br/>Company/Institution: <b>%@</b><br/>Address: <b>%@</b><br/>City: <b>%@</b><br/>Country: <b>%@</b><br/>Contact Number: <b>%@</b><br/>E-Mail: <b>%@</b><br/> <br/> <br/> Message: <b>%@</b>", rName.text, rCompany.text, rAddress.text, rCity.text, rCountry.text, rContactNumber.text, rEmail.text, rDescription.text];
    [tempMailCompose setMessageBody:messageBody isHTML:YES];