UIImage的resizableImageWithCapInsets在iOS 7下带来多个CoreGraphics“无效上下文0x0”错误

时间:2013-10-28 13:37:55

标签: uiimage ios7 core-graphics

我刚刚在iOS 7下注意到resizableImageWithCapInsets的这个问题。突然之间,我收到了这个错误日志,但是我的应用程序没有崩溃:

Oct 28 14:35:15 <Error>: 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.
Oct 28 14:35:15 <Error>: CGContextSetBlendMode: 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.
Oct 28 14:35:15 <Error>: CGContextSetAlpha: 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.
Oct 28 14:35:15 <Error>: CGContextTranslateCTM: 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.
Oct 28 14:35:15 <Error>: CGContextScaleCTM: 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.
Oct 28 14:35:15 <Error>: CGContextGetCTM: 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.
Oct 28 14:35:15 <Error>: 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.
Oct 28 14:35:15 <Error>: CGContextClipToRect: 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.
Oct 28 14:35:15 <Error>: CGContextDrawTiledImage: 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.
Oct 28 14:35:15 <Error>: CGContextRestoreGState: 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.

这是产生错误的代码:

[_registerButton setBackgroundImage:[[UIImage imageNamed:@"image.png"] resizableImageWithCapInsets:(UIEdgeInsets){15, 15, 15, 15}]forState:UIControlStateNormal];

如果我评论上面的行,则错误消失。有其他人遇到过这个错误吗?

1 个答案:

答案 0 :(得分:11)

发现了这个问题。 “image.png”文件高30像素,因此顶部和底部edgeInsets为15,垂直方向没有空白空间。它在视觉上有效,但我收到了这些错误。我希望这对其他人有用。