<Error>: CGContextSetLineCap: invalid context 0x0
There is no current draw context. The issue is from where you are calling the draw methods. They need to be called from a -(void) drawRect method or, if you'd prefer, you can draw into an image. Either way, there has to be a current draw context.
必须从drawRect中触发才能取到绘画上下文。
或者自定义绘画区域进行绘画。
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:drawImage.frame];
(取上下文操作)
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

浙公网安备 33010602011771号