一种解决的方法:CGContextSaveGState: invalid context 0x0
2016-03-16 17:36
316 查看
遇到这个问题找了好久答案,最后排错排出来了
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();
相关文章推荐
- Win10怎么设置开机密码?给win10系统设置登录密码方法
- IAR工程编译错误问题
- DoctrineMigrationsBundle
- iOS UITextField不显示光标
- 编译链接粗浅认识
- python网络编程
- 安卓开发工具、编译工具、sdk、模拟器、版本控制等等
- No compatible targets were found,Do you wish to add a new Android Virtual Device?问题解决方法。
- Swift - 产生不重复数字的随机数生成器
- kotlin练习
- Android获取真正准确的分辨率,拒绝那些瞎扯乱混的文章
- 真正的轻量级WebService框架—使用JAX-WS(JWS)发布WebService(转载)
- 【TopCoder SRM302Div1 900】JoinedString
- socket客户端代码
- Android项目:手机安全卫士(12)—— 通讯卫士之电话短信黑名单设置与拦截
- 拉普拉斯平滑与相似性
- 存储过程的优缺点(转)
- html select 下拉箭头隐藏
- Oracle & SQL Server 数据传输
- CSS3无前缀脚本prefixfree.js/Animatable