나는의 drawRect 구현이 있습니다CGContext 렌더링 유지하지 않는 선은
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
if (self.colorToRender)
{
CGContextSetStrokeColorWithColor(ctx, self.colorToRender.CGColor);
}
else
{
CGContextSetStrokeColorWithColor(ctx,[UIColor whiteColor].CGColor);
}
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, self.center.x, self.center.y);
CGContextAddLineToPoint(ctx, self.pointToRender.x, self.pointToRender.y);
CGContextStrokePath(ctx);
}
이 라인마다 렌더링하지만 렌더링 라인이 화면에 남아 있지 않습니다.
이전에 렌더링 된 선을 유지하면서 화면에 새 선을 렌더링하는 방법은 무엇입니까?
대부분의 경우보기의 clearsContextBeforeDrawing 플래그가 (이 기본이며, 또한 기본적으로 XIB에 체크되어) 설정 -> http://developer.apple.com/library/ios/documentation/UIKit/ 참조/UIView_Class/UIView/UIView.html # // apple_ref/occ/instp/UIView/clearsContextBeforeDrawing – borrrden