图片拉伸是一个开发过程中经常遇到的问题,如何拉伸可以防止图片变形呢?
在iOS6.0中,UIImage提供给我们一个方法处理图片拉伸
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode;
UIImageView *backView = [[UIImageView alloc] init];
CGFloat top = 15; // 顶端盖高度
CGFloat bottom = 15 ; // 底端盖高度
CGFloat left = 10; // 左端盖宽度
CGFloat right = 10; // 右端盖宽度
UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
UIImage *image = [UIImage imageNamed:@"ic_back_reb"];
image = [image resizableImageWithCapInsets:insetsresizingMode:UIImageResizingModeStretch];
backView.image = image;
原文:http://www.cnblogs.com/syc-iOS/p/4891848.html