-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