Fork me on GitHub

<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(); 

posted on 2012-03-17 14:46  pengyingh  阅读(989)  评论(0)    收藏  举报

导航