【发布时间】:2014-08-28 11:31:12
【问题描述】:
我想在 UIView 中制作一个图表。像这样的东西:
有没有比使用这种方法更简单的方法来绘制线条:
-(void)drawRect:(CGRect)rect{
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
// Draw them with a 2.0 stroke width so they are a bit more visible.
CGContextSetLineWidth(context, 2.0f);
CGContextMoveToPoint(context, 0.0f, 0.0f); //start at this point
CGContextAddLineToPoint(context, 20.0f, 20.0f); //draw to this point
// and now draw the Path!
CGContextStrokePath(context);
}
?
【问题讨论】:
-
试试
PCLineChartViewlink,画这样的图表的简单方法 -
好的,谢谢,我去看看。