关于CGContextRef无效的问题
2016-11-07 本文已影响207人
我是卖报滴小行家
在实现CGContextRef制图的过程用,因为直接调用“[self drawRect:self.bounds]”出现啦如下错误:
Nov 7 15:22:09 7777 PasswordDemo[15969] <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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextBeginPath: 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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextSetLineWidth: 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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextSetLineCap: 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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextSetLineJoin: 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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextSetRGBStrokeColor: 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.
Nov 7 15:22:09 7777 PasswordDemo[15969] <Error>: CGContextMoveToPoint: 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.
🐷解决办法:
其实在实现的制图过程中,我们不需要直接调用“[self drawRect:self.bounds]”,只要调用“[self setNeedsDisplay]”即可。