一.图片拉伸
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode
以上两个函数都用于图片的拉伸,两个函数都需要传入一个UIEdgeInsets结构体,结构体如下:
typedef struct UIEdgeInsets {
CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values can be negative to 'outset'
} UIEdgeInsets;
两个函数都表明对以四个参数绘制成的矩形框区域进行拉伸,函数二还有一个UIImageResizingMode参数,它也是一个结构体如下:
typedef NS_ENUM(NSInteger, UIImageResizingMode) {
UIImageResizingModeTile,
UIImageResizingModeStretch,
};
UIImageResizingModeTile:平铺模式 UIImageResizingModeStretch:拉伸模式
来源:CSDN
作者:JerryNil
链接:https://blog.csdn.net/cjw19900903/article/details/21544057