//获取字符串size font:字体 maxsize(最大宽度和最大高度)
-(CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize{
NSDictionary *attrs = @{NSFontAttributeName : font};
return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}
+(UIImage *)resizeImage:(NSString *)name{
UIImage *normal = [UIImage imageNamed:name];
CGFloat w = normal.size.width*0.5;
CGFloat h = normal.size.height*0.5;
return [normal resizableImageWithCapInsets:UIEdgeInsetsMake(h, w, h, w)];
}