给定文字大小(字体),和 段落 宽度,
根据 任意的 文字段落, 给出相应的 段落 宽度
class func heightWithModel(model: FoodCourseSerialModel) -> CGFloat{
let titleH: CGFloat = 20
let marginY: CGFloat = 10
let dict = [NSFontAttributeName: UIFont.systemFontOfSize(17)]
var height: CGFloat = marginY + titleH + marginY
if model.course_subject != nil {
let h = NSString(string: model.course_subject!).boundingRectWithSize(CGSizeMake(kScreenWidth - 20*2, CGFloat.max), options: .UsesLineFragmentOrigin, attributes: dict, context: nil).size.height
let newHeight = CGFloat(Int(h) + 1)
height += (newHeight + marginY)
}
return height
}