iOS 拉伸图片方法
/**
* 拉伸中间
*/
+ (UIImage *)resizedImageWithName:(NSString *)name
{
UIImage *image = [self imageWithNamed:name];
return [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];
}
/**
* 按照某一位置拉伸
*/
+ (UIImage *)resizedImageWithName:(UIImage *)image left:(CGFloat)left top:(CGFloat)top
{
// UIImage *image = [self imageWithNamed:name];
return [image stretchableImageWithLeftCapWidth:image.size.width * left topCapHeight:image.size.height * top];
}