码迷,mamicode.com
首页 > 其他好文 > 详细

一种解决办法:CGContextSaveGState: invalid context 0x0

时间:2015-03-12 19:17:21      阅读:7735      评论:0      收藏:0      [点我收藏+]

标签:

遇到这个问题找了好久答案,最后排错排出来了

CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.


在使用可以拉伸的图片时,希望保留圆角不被拉伸,使用了resizableImageWithCapInsets函数,可能是这个函数没有获取上下文才报的这个错。

于是添加上获取上下文的代码如下:

UIGraphicsBeginImageContext(imageViewSeparate.frame.size);

  imageViewSeparate.image = [[UIImageimageNamed:@"分割线拉伸.png"resizableImageWithCapInsets:UIEdgeInsetsMake(1.0,10.0, 1.0,10.0)];

UIGraphicsEndImageContext();

一种解决办法:CGContextSaveGState: invalid context 0x0

标签:

原文地址:http://blog.csdn.net/yegail/article/details/44225197

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!