【发布时间】:2014-03-21 08:26:59
【问题描述】:
我在 UIView 上画了一条线。当我调用 -setNeedsDisplay 时,我的视图变得清晰并绘制新线。如何继续当前线路?以及如何用动画绘图?谢谢。
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [_color CGColor]);
CGContextSetLineWidth(context, 10.0);
CGContextMoveToPoint(context, _startPointX, 0);
CGContextAddLineToPoint(context, _endPointX, 0);
CGContextStrokePath(context);
}
【问题讨论】:
标签: ios objective-c drawing cgcontext