自动计算label字体的高度和图片拉伸处理
下载地址(分类---功能实现模块封装):
链接: http://pan.baidu.com/s/1kTyFi8R 密码: fm3m
- (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize
{
NSDictionary *attrs = @{NSFontAttributeName : font};
return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin
attributes:attrs context:nil].size;
}
objc CGSize textSize = [message.text
sizeWithFont:HMTextFont maxSize:CGSizeMake(270, MAXFLOAT)];
处理前: 处理后:
下载地址(分类---功能实现模块封装):
链接: http://pan.baidu.com/s/1i36QGYx 密码: hui9
- (UIImage *)resizingWith:(NSString *)imageName
{
UIImage *image = [UIImage imageNamed:imageName];
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.5, image.size.width * 0.5,
image.size.height * 0.5 - 1, image.size.width * 0.5 - 1)];
return image;
}
objc UIImage *image = [UIImage imageResizingWith:@"chat_send_nor"];
自动计算label字体的高度和图片拉伸处理(封装成分类分享)
原文:http://www.cnblogs.com/LongLJ/p/5002072.html