【问题收集】英文文本过长换行问题

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)

你可能感兴趣的:(【问题收集】英文文本过长换行问题)