一种解决办法:CGContextSaveGState: invalid context 0x0
2015-03-12 18:07
405 查看
遇到这个问题找了好久答案,最后排错排出来了
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. 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
- 点击文本框第一次输入中文的时候出现CGContextSaveGState: invalid context 0x0
- CGContextSaveGState: invalid context 0x0
- 编译器警告:CGContextSaveGState: invalid context 0x0
- CGContextSaveGState: invalid context 0x0. This is a serious error.
- 使用UIBezierPath绘图控制台<Eorro>CGContextSaveGState: invalid context 0x0,CGContextSetLineWidth: invalid co
- UIBezierPath CGContextSaveGState: invalid context 0x0. This is a serious error.
- <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_C
- xcode 7 错误:CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG
- 【iOS】CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable
- CGContextSaveGState: invalid context
- ios错误<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set
- CGContextSaveGState: invalid context
- 升级到XCode7后出现 <Error>: CGContextSaveGState: invalid context 0x0.
- ios修改status bar颜色及xcode7下日志出现CGContextSaveGState: invalid context 0x0错误
- CGContextSaveGState: invalid context
- 《iOS总结》 <Error>: CGContextSaveGState: invalid context 0x0.
- UIBezierPath CGContextSaveGState: invalid context 0x0. This is a serious error.
- CGContextSaveGState与UIGraphicsPushContext的区别
- Linux加载驱动"invalid module format"错误的一种可能解决办法