ios – CGContextSetFillColorWithColor:无效上下文0x0

ios – CGContextSetFillColorWithColor:无效上下文0x0,第1张

概述CGContextSetFillColorWithColor:无效上下文0x0.这是一个严重的错误.该应用程序或其使用的库正在使用无效的上下文,从而有助于整体降低系统的稳定性和可靠性.这个通知是礼貌的:请解决这个问题.这将在即将到来的更新中成为致命的错误. 我从这个方法的[color setFill]行得到错误.有什么想法可以解决吗? + (UIImage *)fillImage:(UIImag CGContextSetFillcolorWithcolor:无效的上下文0x0.这是一个严重的错误.该应用程序或其使用的库正在使用无效的上下文,从而有助于整体降低系统的稳定性和可靠性.这个通知是礼貌的:请解决这个问题.这将在即将到来的更新中成为致命的错误.

我从这个方法的[color setFill]行得到错误.有什么想法可以解决吗?

+ (UIImage *)fillimage:(UIImage*)image withcolor:(UIcolor *)color{    // begin a new image context,to draw our colored image onto    UIGraphicsBeginImageContextWithOptions(image.size,NO,[[UIScreen mainScreen] scale]);    // get a reference to that context we created    CGContextRef context = UIGraphicsGetCurrentContext();    // set the fill color    [color setFill];    // translate/flip the graphics context (for transforming from CG* coords to UI* coords    CGContextTranslateCTM(context,image.size.height);    CGContextScaleCTM(context,1.0,-1.0);    // set the blend mode to overlay,and the original image    CGContextSetBlendMode(context,kCGBlendModeOverlay);    CGRect rect = CGRectMake(0,image.size.wIDth,image.size.height);    //if(overlay) CGContextDrawImage(context,rect,img.CGImage);    // set a mask that matches the shape of the image,then draw (overlay) a colored rectangle    CGContextClipToMask(context,image.CGImage);    CGContextAddRect(context,rect);    CGContextDrawPath(context,kCGPathFill);    // generate a new UIImage from the graphics context we drew onto    UIImage *coloredimg = UIGraphicsGetimageFromCurrentimageContext();    UIGraphicsEndImageContext();    //return the color-burned image    return coloredimg;}
解决方法 您的image.size无效,因此UIGraphicsBeginImageContextWithOptions不会创建图形上下文. image.size.wIDth都必须是正数,有限数.

图像本身可能是零.当您将大小消息发送到nil时,您将返回CGSizeZero.

总结

以上是内存溢出为你收集整理的ios – CGContextSetFillColorWithColor:无效上下文0x0全部内容,希望文章能够帮你解决ios – CGContextSetFillColorWithColor:无效上下文0x0所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1110638.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存