IOS图片拉伸模式

IOS5.0之前

 - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight;

 

IOS5.0

CGFloat top = 25; // 顶端盖高度
CGFloat bottom = 25 ; // 底端盖高度
CGFloat left = 10; // 左端盖宽度
CGFloat right = 10; // 右端盖宽度
UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);

 

- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets

 

IOS6.0

- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode

 

 

image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];

posted @ 2014-11-24 11:02  銱ル╬鎯噹  阅读(133)  评论(0编辑  收藏  举报