New line and returns ignored in setMessageBody

后端 未结 2 1874
遇见更好的自我
遇见更好的自我 2021-02-20 01:33

Am I doing something dumb? I can pre-fill and email ok but the \"\\r\\n\" is ignored in the emailBody:

- (void) sendEventInEmail
{
    MFMailComposeViewControlle         


        
2条回答
  •  臣服心动
    2021-02-20 02:09

    If isHTML set YES \n does not work you either have to set isHTML:NO or use a HTML line break such as
    to enter a new line.

    inserts a new paragraph which usually means double line break.

    Try this with isHTML:YES:

    [picker setMessageBody:@"1st line
    2nd line
    3rd line
    and so on..." isHTML:YES];

    If isHTML:NO just put \n

    [picker setMessageBody:@"1st line\n2nd line\n3rd line\nand so on..." isHTML:NO]; 
    

    It will give you this:

    1st line
    2nd line
    3rd line
    and so on...

提交回复
热议问题