UIImage 拉伸

// 加载原图

UIImage *image = [UIImage imageNamed:@"chat_send_nor"];

// 拉伸处理(说明需要保护的区域)

image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(30, 30, 30, 30) resizingMode:UIImageResizingModeStretch];

// left

// top

// width

// height

// right = width - left - 1;

// bottom = height - top - 1;

// 根据以上公式计算,需要你给出左边保护多少,和上面保护多少

image = [image stretchableImageWithLeftCapWidth:image.size.width * 0.5 topCapHeight:image.size.height * 0.5];

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容