iOS UITextView 纯英文排版换行出错的解决方案
博客中代码:
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
NSDictionary *attributes = @{NSParagraphStyleAttributeName:paragraphStyle};
_contentTextView.attributedText = [[NSAttributedString alloc]initWithString:_contentTextView.text attributes:attributes];
对应的[Swift](http://lib.csdn.net/base/swift)代码:
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineBreakMode = NSLineBreakMode.ByCharWrapping;
let attributes = [NSParagraphStyleAttributeName:para]
_contentTextView.attributedText = NSAttributedString.init(string:_contentTextView.text, attributes: attributes)
网友评论