1

I want to use an function to pass a lot of points to another function, but the Xcode has errors on the line with: CGContextAddLines......

the add points is filled with information like:

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

the use the -(void) constructPoints:(CGContextRef) context withPoints:(CGPoint) addPoints {

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

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

// and draw-it

}

RNB-IT
  • 245
  • 1
  • 2
  • 5

1 Answers1

1

Try it like this:

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

  // and draw-it

}

Then on your call:

[self constructPoints:yourContext withPoints:addPoints numPoints:sizeof(addPoints)/sizeof(addPoints[0])];
Fernando Madruga
  • 1,746
  • 13
  • 11