func nameHeight() {
let str:String = "斯蒂芬斯蒂芬斯蒂芬斯蒂芬";
var attrButes:[NSAttributedString.Key : Any]! = nil;
let paraph = NSMutableParagraphStyle()
paraph.lineSpacing = 10
attrButes = [NSAttributedString.Key.font:UIFont.systemFont(ofSize: 13.5),NSAttributedString.Key.paragraphStyle:paraph]
let size:CGRect = str.boundingRect(with: CGSize(width: 200, height: CGFloat.greatestFiniteMagnitude), options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: attrButes, context: nil)
content.attributedText = NSAttributedString(string: str, attributes: attrButes)
content.numberOfLines = 0
content.sizeToFit()
}
网友评论