func labelWithHeight(labelStr:String,label:UILabel,width:CGFloat) ->CGFloat {
let statusLabelText: NSString = labelStr as NSString
let size = CGSize(width: SCREENWIDTH - width, height: 900)
let dic = NSDictionary(object: label.font, forKey: NSFontAttributeName as NSCopying)
let strSize = statusLabelText.boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: dic as? [String : AnyObject], context: nil).size
return strSize.height
}
计算Label高度swift
最新推荐文章于 2022-04-02 10:50:50 发布