iOS开发--UILabel可以显示\n

 1 UILabel*label;
 2     
 3  //设置换行
 4 label.lineBreakMode = UILineBreakModeWordWrap; 
 5 label.numberOfLines = 0;
 6     
 7 换行符还是“\n”
 8 比如NSString * xstring=@"lineone\nlinetwo"
 9 
10 如果内容是从HTTP返回数据,且换行失败,可以考虑用以下方法测试:
11 
12 NSString *myNewLineStr = @"\n";
13 myLabelText = [myLabelText stringByReplacingOccurrencesOfString:@"\\n" withString:myNewLineStr];
14 myLabel.text = myLabelText;

ref:http://laiguowei2004.blog.163.com/blog/static/36829000201281734249254/

posted @ 2015-08-05 22:29  feiling  阅读(763)  评论(0编辑  收藏  举报