我想使用一个函数将很多点传递给另一个函数,但是Xcode在行上有错误:CGContextAddLines ......
添加点充满了以下信息:
CGPoint addPoints [] = { CGPointMake(10,10), CGPointMake(10,10), }
使用了 - (void)constructPoints:(CGContextRef)context withPoints:(CGPoint)addPoints {
// do some context set attributes, color
// and
CGContextAddLines(context,addPoints,sizeof(addPoints)/ sizeof(addPoints [0]));
//并绘制它 -
}
答案 0 :(得分: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])];