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

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的更多相关文章

  1. 编译器警告:CGContextSaveGState: invalid context 0x0

    一.问题描述 下载图片,然后用Quartz2D绘制缩放的图片,运行无法显示图片并且编译器警告: Aug 18 21:41:50  02_计算UITableViewCell的行高[16777] < ...

  2. 【iOS】CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable

    CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SH ...

  3. CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

    最近在测试的过程中, 发现了SpringBoar的一个问题: SpringBoard[53] <Error>: CGContextTranslateCTM: invalid context ...

  4. invalid context 0x0.

    在展示图片或者做二维码的时候,若是宽或者高有一个为零的情况就会报错:CGBitmapContextCreateImage: invalid context 0x0. If you want to se ...

  5. 关于CGContextSetBlendMode: invalid context 0x0的错误

    在ios 7的模拟器中,选择一个输入框准备输入时,会触发这个错误,以下是出错详细日志: <Error>: CGContextSetBlendMode: invalid context 0x ...

  6. iOS关于CGContextSetBlendMode: invalid context 0x0的错误

    在ios 7的模拟器中,选择一个输入框准备输入时,会触发这个错误,以下是出错详细日志: <Error>: CGContextSetBlendMode: invalid context 0x ...

  7. SQL Server 数据库没有有效全部者的三种解决的方法

    问题:     开发的过程中,操作系统出了问题.决定重装系统.可是没有将SQL Server中的数据库文件分离出来,直接将系统格了.在新系统数据库中附加了数据库文件,一切还算正常.但当打开数据库关系图 ...

  8. Thinkphp 无法使用-&gt;order() 排序的两种解决的方法!

    使用ThinkPHP,却发现无法使用->order($order)来排序. $order = " info.date2 desc "; 非常遗憾的是这样写结果order却变成 ...

  9. <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

    转自这里   出 错原因:设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller- based status bar appearance为NO,默 ...

随机推荐

  1. 关于考虑浏览器兼容性时间的工具demo

    //支持跨浏览器的添加事件. var btn = document.getElementById("btn"); function showMes() { alert(" ...

  2. javascript为目标位置div等设置高度

    应该是DOM的东西: document.getElementById("目标id").style.height = 多高(数值)+"px";

  3. 当INPUT 连续输入是连续触发

    在 Web 开发中经常会碰到需要动态监听输入框值变化的情况,如果使用 onkeydown.onkeypress.onkeyup 这个几个键盘事件来监测的话,监听不了右键的复制.剪贴和粘贴这些操作,处理 ...

  4. php函数——『解析 xml数据』

    <?php //该文件是 //$raw_post_data = file_get_contents('php://input'); //file_put_contents('a.txt', $r ...

  5. linux下Rtree的安装

    1. 首先安装依赖libspatialindexhttp://libspatialindex.github.io/ sudo ./configure sudo make sudo make insta ...

  6. 【深入浅出jQuery】源码浅析2--使用技巧

    最近一直在研读 jQuery 源码,初看源码一头雾水毫无头绪,真正静下心来细看写的真是精妙,让你感叹代码之美. 其结构明晰,高内聚.低耦合,兼具优秀的性能与便利的扩展性,在浏览器的兼容性(功能缺陷.渐 ...

  7. BZOJ 1055 玩具取名

    Description 某人有一套玩具,并想法给玩具命名.首先他选择WING四个字母中的任意一个字母作为玩具的基本名字.然后他会根据自己的喜好,将名字中任意一个字母用“WING”中任意两个字母代替,使 ...

  8. Linux Shell编程(7)——变量赋值

    =赋值操作符(它的左右两边不能有空白符) 不要搞混了=和-eq,-eq是比赋值操作更高级的测试.注意:等于号(=)根据环境的不同它可能是赋值操作符也可能是一个测试操作符.例子:简单的变量赋值 #!/b ...

  9. 图论(floyd算法):NOI2007 社交网络

    [NOI2007] 社交网络 ★★   输入文件:network1.in   输出文件:network1.out   简单对比 时间限制:1 s   内存限制:128 MB [问题描述] 在社交网络( ...

  10. 后缀数组:SPOJ SUBST1 - New Distinct Substrings

    Given a string, we need to find the total number of its distinct substrings. Input T- number of test ...