Answers:
我发现当我从.plist
文件中读取字符串时,出现的"\n"
解析为"\\n"
。对我来说,解决办法是更换的出现"\\n"
有"\n"
。例如,给定一个从文件读取的NSString
named 实例,我必须调用...myString
.plist
myString = [myString stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
...在将其分配给我的UILabel
实例之前...
myLabel.text = myString;
NSString *str1 = @"Share Role Play Photo via Facebook, or Twitter for free coins per photo.";
NSString *str2 = @"Like Role Play on facebook for 50 free coins.";
NSString *str3 = @"Check out 'What's Hot' on other ways to receive free coins";
NSString *msg = [NSString stringWithFormat:@"%@\n%@\n%@", str1, str2, str3];
NSString的换行符为\ r
正确的使用方式 [NSString StringWithFormat:@"%@\r%@",string1,string2];
\ r ---->回车