//计算Label 的size
let attr = NSMutableAttributedString(string: headView.headDeatil.text!)
let frameSetterRef = CTFramesetterCreateWithAttributedString(attr)
let cfRange = CFRangeMake(0, 0)
let maxSize = CGSizeMake(UIScreen.mainScreen().bounds.size.width, CGFloat.max)
let size = CTFramesetterSuggestFrameSizeWithConstraints(frameSetterRef, cfRange, nil, maxSize, nil)
网友评论