swift 计算Label的高度

//计算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)

推荐阅读更多精彩内容