我想了解,UIgraphicsGetImageContext()函数,从我的理解,它的函数,它从当前位图上下文获取图像,所以当我在画布上绘制的东西,并调用此函数,我得到绘制的图像,但假设我不绘制任何东西,然后它也提取一个空的图像。所以我想明白,我们如何检查canvas(CGContext)是否为零。获取图像使用UIGraphicsGetImageFromCurrentImageContext
下面是我的代码,我试过了,但它不工作
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO,0.0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
if(UIGraphicsGetCurrentContext() == nil)
{
NSLog(@"NIL");
}
else
{
m_curImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSLog(@"%@",m_curImage);
}
因此,朋友们,请让我知道如何得到这一点,将有助于我
问候 兰吉特
对不起,我知道它太旧了,但你有没有找到答案? – Aziz 2013-09-07 11:18:39