user1520252
user1520252

Reputation: 121

how to make the email body some text on new line in iphone application

I am sending email from iphone application i want that

in body field right now MyScroe and My Time are showing on same line i want that they should be on separate line each how to show that

    NSString * emailBody = [NSString stringWithFormat:@"My Score: %d/%d, My Time: %@", numberOfCorrectAnswer, [[[DataManager sharedInstance] questions] count], time];
    [picker setMessageBody:emailBody isHTML:NO];

Upvotes: 0

Views: 1738

Answers (3)

Mick MacCallum
Mick MacCallum

Reputation: 130193

You can insert a line break in this string by using the "\n" escape. Every "\n" represents a line break where ever it is added.

Upvotes: 0

Sanchit Paurush
Sanchit Paurush

Reputation: 6152

Use escape sequences for it. Try \n of new line. One \n for one line

NSString * emailBody = [NSString stringWithFormat:@"My Score: %d/%d, \n\nMy Time: %@", numberOfCorrectAnswer, [[[DataManager sharedInstance] questions] count], time];

Upvotes: 0

alex-i
alex-i

Reputation: 5454

"\n\r" should work in your case. If you wish to change to html (isHTML:YES), then you'll have to use "<br/>"

NSString * emailBody = [NSString stringWithFormat:@"My Score: %d/%d\n\rMy Time: %@", numberOfCorrectAnswer, [[[DataManager sharedInstance] questions] count], time];

Upvotes: 5

Related Questions