1

我想使用一个函数将很多点传递给另一个函数,但是Xcode有错误就行了:CGContextAddLines......

添加点充满了如下信息:

CGPoint addPoints[] = { CGPointMake(10,10), CGPointMake(10,10), }

使用 -(void)constructPoints:(CGContextRef) 上下文 withPoints:(CGPoint) addPoints {

// do some context set attributes, color
// and 

CGContextAddLines(context, addPoints, sizeof(addPoints)/sizeof(addPoints[0]));

// 并绘制它

}

4

1 回答 1

1

试试这样:

-(void) constructPoints:(CGContextRef) context withPoints:(CGPoint[]) addPoints numPoints:(int) size {
  // do some context set attributes, color
  // and 
  CGContextAddLines(context, addPoints, size);

  // and draw-it

}

然后在您的电话中:

[self constructPoints:yourContext withPoints:addPoints numPoints:sizeof(addPoints)/sizeof(addPoints[0])];
于 2012-02-17T22:38:44.507 回答