Rollback drawRect:
Is there any way to quit from drawRect:
without refresh the current UIView
?
For example:
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetLineWidth(context, 2);
CGContextMoveToPoint(context, 10.0, 30.0);
CGContextAddLineToPoint(context, 310.0, 30.0);
CGContextStrokePath(context);
//I w开发者_如何学运维ould like to return from here and rollback all changes in drawRect:
}
Thanks!
If you haven't started drawing into the context, it might be possible to just return from drawRect:
. You'd have to set the clearsContextBeforeDrawing
property of the view to NO before.
After starting to draw in the context, the view/layer will always update its content.
精彩评论