首页 > 移动平台 > 详细

iOS 绘图时使用 UIGraphicsGetCurrentContext() 报错的原因分析

时间:2014-03-20 10:24:12      阅读:568      评论:0      收藏:0      [点我收藏+]

问题描述:

CGContextRef ctx = UIGraphicsGetCurrentContext();

为什么会报这个错误:is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability

有道翻译:是使用一个无效的上下文,从而导致整体退化系统稳定性和可靠性


bubuko.com,布布扣


默认是Nil,在调用 drawRect前,视图对象会先往栈上压入一个有效的上下文并使它成为当前上下文。

如果你不是使用UIView对象来做绘画操作,那么你就得使用 UIGraphicsPushContext 函数手工往栈上压入一个有效的上下文了


bubuko.com,布布扣

综上所述,可能是没在UIView类的 drawRect 里面来操作,这个方法是由框架来调用的,调用前,UIView内部会加一个进去!


iOS 绘图时使用 UIGraphicsGetCurrentContext() 报错的原因分析,布布扣,bubuko.com

iOS 绘图时使用 UIGraphicsGetCurrentContext() 报错的原因分析

原文:http://blog.csdn.net/opengl_es/article/details/21588371

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!