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

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. C# winform 右下角弹窗

    [DllImport("user32")] private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, in ...

  2. Canvas实现文字粒子化,并且绕轴旋转(初号机)

    写下来发现,程序在细节上处理的很差,比如旋转的时候,在终点处有明显的撞墙感觉,以及小部分粒子存在精度差异,导致撞击后不与整体平衡. 注释全在代码中了,就不多说了,另外感觉写的旋转的规则有点怪,后续再调 ...

  3. 总结几种C#窗体间通讯的处理方法

    摘要:本文介绍了C#窗体间通讯的几种处理方法,即传值.继承.事件回调,希望对大家有用. http://www.cnblogs.com/jara/p/3439603.html 应用程序开发中,经常需要多 ...

  4. 那些年被我坑过的Python——第十章Broker(rabbitMQ/redis)

    基于RabbitMQ的direct任务驱动异步RPC程序实现: RPC_dispatcher指令分发器: #!/usr/bin/env python # -*- coding:utf-8 -*- __ ...

  5. Oracle数据库还原方法

    Win +X → 运行→cmd C:\Documents and Settings\Administrator>sqlplus /nolog SQL> connect sys/passwo ...

  6. jQuery取CSS的HEX(16位)颜色值

    //IE10以上版本.CHROME.FIREFOX中GRB颜色转HEX颜色值 $.fn.getBackgroundColor = function() { var rgb = $(this).css( ...

  7. go语言细节

    1 数组与字符串为值类型,切片.映射.通道为值类型,赋值需注意. package main import ( "fmt" ) func main() { //数组 a1 := [] ...

  8. BZOJ 2330 糖果

    Description 幼儿园里有N个小朋友,lxhgww老师现在想要给这些小朋友们分配糖果,要求每个小朋友都要分到糖果.但是小朋友们也有嫉妒心,总是会提出一些要求,比如小明不希望小红分到的糖果比他的 ...

  9. codeforces B. Prison Transfer

    题意:输入n,t,c,再输入n个数,然后问有多少个连续区间内的最大值小于等于t; #include <cstdio> #include <cstring> #include & ...

  10. 用c写99乘法表

    int main(int argc,char **argv){ int a; for(a=1;a<=9;a++){ int b; for(b=1;b<=a;b++){ printf(&qu ...