用**MFMailComposeViewController**創建email
我想要在文本位置顯示這樣:
Hi,
This application bla bla bla.
To make this work you have to bla bla.
Thanks.
有四段內容,我想添加一個空格,代碼如下:
NSString *body = @"Hi,\n\nThis application bla bla bla.\n\nTo make this work you have to bla boa.\n\nThanks\n\n";
可以在每段之間添加一個空格。
我能想到的方法是用<br />
,將email添加為HTML,但是我希望是有最大兼容性的普通文本。
不知道怎麼實現?
首先 確保下面的方法中設置好isHTML:NO
,設置好isHTML:NO, \n
下面的代碼就可以實現:
NSString *body = @"Hi,\n\nThis application bla bla bla.\n\nTo make this work you have to bla boa.\n\nThanks\n\n";
[mailComposer setMessageBody:body isHTML:NO];
輸出:
Hi,
This application bla bla bla.
To make this work you have to bla bla.
Thanks.