九点图
//返回一個可拉伸的圖片
- (UIImage *)resizeWithImageName:(NSString *)name
{UIImage *normal = [UIImage imageNamed:name];// CGFloat w = normal.size.width * 0.5f ;// CGFloat h = normal.size.height *0.5f ;CGFloat w = normal.size.width*0.8;CGFloat h = normal.size.height*0.8;//傳入上下左右不需要拉升的編劇,只拉伸中間部分return [normal resizableImageWithCapInsets:UIEdgeInsetsMake(h, w, h, w)];// [normal resizableImageWithCapInsets:UIEdgeInsetsMake(<#CGFloat top#>, <#CGFloat left#>, <#CGFloat bottom#>, <#CGFloat right#>)]// 1 = width - leftCapWidth - right// 1 = height - topCapHeight - bottom//傳入上下左右不需要拉升的編劇,只拉伸中間部分,并且傳入模式(平鋪/拉伸)// [normal :<#(UIEdgeInsets)#> resizingMode:<#(UIImageResizingMode)#>]//只用傳入左邊和頂部不需要拉伸的位置,系統會算出右邊和底部不需要拉升的位置。并且中間有1X1的點用于拉伸或者平鋪// 1 = width - leftCapWidth - right// 1 = height - topCapHeight - bottom// return [normal stretchableImageWithLeftCapWidth:w topCapHeight:h];
}
總結
- 上一篇: 世界读书日送你畅销好书!前所未有4折购书
- 下一篇: JPush+SAE+J2EE实现微信公众