zoukankan      html  css  js  c++  java
  • 一种解决的方法:CGContextSaveGState: invalid context 0x0

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

    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();

  • 相关阅读:
    资产采集:
    思想:
    Redis 以及 Python操作Redis
    Django在使用Mysql迁移数据库时,会报的错
    HTML
    数据库操作(四)
    数据库操作(二)
    数据库操作(三)
    数据库操作(一)
    MySQL的sql_mode模式说明及设置
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/5284413.html
Copyright © 2011-2022 走看看