UIImage* img=[UIImage imageNamed:
@"name.png"];
//原图
UIEdgeInsets edge=UIEdgeInsetsMake(
0,
10,
0,
10);
//UIImageResizingModeStretch:拉伸模式,通过拉伸UIEdgeInsets指定的矩形区域来填充图片
//UIImageResizingModeTile:平铺模式,通过重复显示UIEdgeInsets指定的矩形区域来填充图
img=
[img resizableImageWithCapInsets:edge resizingMode:UIImageResizingModeStretch];
imageView.image=img;