---------- UIImage+CZHelp.h ----------
#import <UIKit/UIKit.h>
@interface UIImage (CZHelp)
+ (UIImage *)resizedImageNamed:(NSString *)name leftScale:(CGFloat)leftScale topScale:(CGFloat)topScale;
+ (UIImage *)resizedImageNamed:(NSString *)name;
@end
---------- UIImage+CZHelp.m ----------
#import "UIImage+CZHelp.h"
@implementation UIImage (CZHelp)
+ (UIImage *)resizedImageNamed:(NSString *)name
{
return [self resizedImageNamed:name leftScale:0.5 topScale:0.5];
}
+ (UIImage *)resizedImageNamed:(NSString *)name leftScale:(CGFloat)leftScale topScale:(CGFloat)topScale
{
UIImage *image = [UIImage imageNamed:name];
return [image stretchableImageWithLeftCapWidth:image.size.width * leftScale topCapHeight:image.size.height * topScale];
}
@end