2011-06-02 26 views
0

我試圖在我的電子郵件正文中的每個字符串之後得到回車符。我正在畫空白。在格式字符串中添加回車符

這是我使用的時刻代碼:

- (IBAction)mailButtonPressed { 
    MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; 
    controller.mailComposeDelegate = self; 
    [controller setSubject:@"Pressed Data..."]; 

    appDelegate= (TemplateIponeAppDelegate *)[UIApplication sharedApplication].delegate; 

    NSString *MessageBody=[NSString stringWithFormat:@" Hi: %@ F Result: %d , R Result: %d , B Result: %d, P Result: %d......... total Reults: %d total time :%@",clientName.text, appDelegate.FCount,appDelegate.RCount,appDelegate.BCount,appDelegate.PCount,appDelegate.TotalPressed,appDelegate.time]; 

    [controller setMessageBody:MessageBody isHTML:NO]; 
    [self presentModalViewController:controller animated:YES]; 
    [controller release]; 
} 

回答

3

在格式字符串添加\n無論你想一個新的生產線。

+0

在電子郵件中,CR LF應該是'\ r \ n'。 – 2011-06-04 01:46:14

+1

這裏還有一個重要的關鍵...因爲我一直在網上找這個小時。它必須是HTMLHTML:NO。是的,它會刪除\ n的。 – badweasel 2012-09-27 23:35:13