计算label的文字高度:
func getTextHeigh(textStr : String, font : UIFont, width : CGFloat) -> CGFloat{
let normalText : NSString = textStr as NSString
let size = CGSize(width: width, height:1000) //CGSizeMake(width,1000)
let dic = NSDictionary(object: font, forKey : kCTFontAttributeName as! NSCopying)
let stringSize = normalText.boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: dic as? [NSAttributedStringKey:Any], context:nil).size
return stringSize.height
}