//自适应高度
+ (CGFloat)HeightWithText:(NSString*)text width:(CGFloat)width font:(CGFloat)font
{
CGSizesize =CGSizeMake(width,HEIGHT);
NSDictionary*dic =@{NSFontAttributeName: [UIFontsystemFontOfSize:font]};
CGRectrect = [textboundingRectWithSize:sizeoptions:NSStringDrawingUsesLineFragmentOriginattributes:diccontext:nil];
returnrect.size.height;
}
//自适应宽度
+ (CGFloat)WidthtWithText:(NSString*)text height:(CGFloat)height font:(CGFloat)font
{
CGSizesize =CGSizeMake(WIDTH, height);
NSDictionary*dic =@{NSFontAttributeName: [UIFontsystemFontOfSize:font]};
CGRectrect = [textboundingRectWithSize:sizeoptions:NSStringDrawingUsesLineFragmentOriginattributes:diccontext:nil];
returnrect.size.width;
}