The method (sizeWithFont: forWidth: lineBreakMode:)
was deprecated in iOS 7.0.
But how can I do a same thing like following code in iOS 7.0?
For those who want the height with width function but in swift its:
func HeigthWithWidth(stringToSize : String, width : CGFloat, font : UIFont) -> CGFloat {
var attrStr = NSMutableAttributedString(string: stringToSize);
attrStr.addAttribute(NSFontAttributeName, value: font, range: NSRange.init(location: 0, length: stringToSize.characters.count));
var rect = attrStr.boundingRectWithSize(CGSize(width: width, height: CGFloat.max), options: [NSStringDrawingOptions.UsesLineFragmentOrigin, NSStringDrawingOptions.UsesFontLeading], context: nil);
return rect.size.height;
}
Hope that helps those who come looking later