如何在Objective-C中创建一个空白的透明png? [英] How to create a blank transparent png in Objective-C?
本文介绍了如何在Objective-C中创建一个空白的透明png?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式在Objective C中创建一个空白的png UIImage(比方说36x36像素)?
How can I create a blank png UIImage in Objective C programmatically (let's say 36x36 px)?
谢谢:)
推荐答案
您可以打开图像上下文,然后立即收集其内容,而不会在其中绘制任何内容。这应该产生一个空白 36x36
UIImage
:
You can open an image context, and then harvest its content immediately, without drawing anything into it. This should produce a blank 36x36
UIImage
:
UIGraphicsBeginImageContextWithOptions(CGSizeMake(36, 36), NO, 0.0);
UIImage *blank = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这篇关于如何在Objective-C中创建一个空白的透明png?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文