gpt4 book ai didi

ios - 使用使用 capInsets 增长图像的 CoreGraphics 绘制 UIImage

转载 作者:行者123 更新时间:2023-11-28 22:11:22 28 4
gpt4 key购买 nike

假设我在 Images.xcassets 中存储了一张切片的图像;即它的 capInsets 属性已设置,我想在 CoreGraphics 中绘制比其实际大小更大的图像。我该怎么做?

我是否必须使用 capInsets 属性手动将图像分成 9 个部分,然后手动增长/拉伸(stretch)这 9 个部分,还是有更简单的方法?

最佳答案

    UIGraphicsBeginImageContext(litView.layer.frame.size);
[litImg drawInRect:litView.layer.frame];
UIImage *resizedImg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

关于ios - 使用使用 capInsets 增长图像的 CoreGraphics 绘制 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22846903/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com