-1
我想绘制15条水平线,它们之间有20个点的距离。我不明白为什么这个代码不起作用。绘制多行石英2D
- (void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextSetLineWidth(context, 2.0);
for (int i=20;i+=20;i<=20*15) {
CGContextBeginPath(context);
CGContextMoveToPoint(context, 10, i);
CGContextAddLineToPoint(context, 310, i);
CGContextStrokePath(context);
}
}
谢谢!
没关系。我是个白痴。我写了for循环错误。 – Cosmin 2012-04-04 10:10:26