+(CGFloat)heightOfString:(NSString*)string withConstrainSize:(CGSize)size withAttributes:(NSDictionary*)attributes{
CGFloat height = 0;
string = [string stringByReplacingOccurrencesOfString:@"\r" withString:@""];
NSArray* stringArray = [string componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\n"]];
for (NSString* string in stringArray) {
if (string.length > 0) {
CGRect bounds = [string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:attributes context:nil];
height += bounds.size.height;
}
}
return height;
}