IOS开发之图片拉伸不变形实现
(UIImage )imageCreatWithCap:(NSString )imageName { UIImage *image = [UIImage imageNamed:imageName]; // 设置左边端盖宽度 NSInteger leftCapWidth = image.size.width * 0.5; // 设置上边端盖高度 NSInteger topCapHeight = image.size.height * 0.5; return [image stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight]; }