且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在CoreGraphics iphone中将CGLayer转换为*透明* UIImage和PNG文件

更新时间:2023-11-11 23:14:22

我刚刚处理了这个问题。不要在 CGLayer 上绘制背景,然后将 UIView 的背景设置为:

I just dealt with this. Don't draw a background on the CGLayer and then set the background of the UIView to:

self.backgroundColor = [UIColor clearColor];

应该这样做,您的png将具有透明背景。

That should do it and your png will have a transparent background.