我试过移动[path closePath];低于这4行,但它不会改变任何东西.我还在第一行之前设置了一个断点,并逐行手动完成了这个功能,而这只是造成严重破坏的4行.
对于这个问题似乎是一个趋势,一切都完全按照它应该呈现,但它会使控制台充满这些类型的消息.
任何帮助将不胜感激,我很乐意提供更多信息和更新.
功能:
-(CAShapeLayer *)lineBetweenPoint:(CGPoint)start andPoint:(CGPoint)end { //Draw the first circle UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:start radius:kLineEndRadius startAngle:0 endAngle:DEGREES_TO_RADIANS(360) clockwise:TRUE]; //Add the line [path moveToPoint:start]; [path addLineToPoint:end]; [path moveToPoint:end]; //Draw the second circle [path addArcWithCenter:end radius:kLineEndRadius startAngle:0 endAngle:DEGREES_TO_RADIANS(360) clockwise:TRUE]; //Close the path and set the coloring [path closePath]; /*The following 4 lines cause problems*/ [[UIColor blueColor] setStroke]; /*CAUSES PROBLEM*/ [[UIColor blueColor] setFill]; /*CAUSES PROBLEM*/ [path stroke]; /*CAUSES PROBLEM*/ [path fill]; /*CAUSES PROBLEM*/ //Create a shape layer CAShapeLayer *shapeLayer = [CAShapeLayer layer]; shapeLayer.path = [path CGPath]; shapeLayer.strokeColor = [kLineColor CGColor]; shapeLayer.lineWidth = kLineWidth; shapeLayer.fillColor = [kLineColor CGColor]; //Return the layer return shapeLayer; }
日志输出:
: CGContextSetStrokeColorWithColor: 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.: CGContextSetFillColorWithColor: invalid context 0x0. This is
a serIoUs error. This application,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.: CGContextSaveGState: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextSetLineWidth: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextSetLineJoin: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextSetLineCap: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextSetMiterLimit: invalid context 0x0. This is a
serIoUs error. This application,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.: CGContextSetFlatness: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextAddPath: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextDrawPath: invalid context 0x0. This is a serIoUs
error. This application,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.: CGContextRestoreGState: invalid context 0x0. This is a
serIoUs error. This application,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.