IOS开发之图片拉伸不变形实现
程序员文章站
2022-07-05 22:21:18
ios开发之图片拉伸不变形实现
(uiimage )imagecreatwithcap:(nsstring )imagename {
uiimage *image = [uiimage im...
ios开发之图片拉伸不变形实现
(uiimage )imagecreatwithcap:(nsstring )imagename { uiimage *image = [uiimage imagenamed:imagename]; // 设置左边端盖宽度 nsinteger leftcapwidth = image.size.width * 0.5; // 设置上边端盖高度 nsinteger topcapheight = image.size.height * 0.5; return [image stretchableimagewithleftcapwidth:leftcapwidth topcapheight:topcapheight]; }