gpt4 book ai didi

iphone - 来自 CALayer 的 CGImage(或 UIImage)

转载 作者:太空狗 更新时间:2023-10-30 03:48:26 34 4
gpt4 key购买 nike

我创建了一个 CALayer (我向图层添加了几个形状,但最终,我只有一个 CALayer),而且我在将它添加到 CGImage 时遇到了很多麻烦。我找到了一些对 [CALayer renderInContext:ctx] 的引用,但我不确定如何实现它。

有人做过吗?

最佳答案

试试这个...

UIGraphicsBeginImageContext(layer.bounds.size);
[layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

关于iphone - 来自 CALayer 的 CGImage(或 UIImage),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3816527/

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