UserGraphBuff = UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(UserGraphBuff,5,10,0,1);
CGContextSetLineWidth(UserGraphBuff, 2 );
CGContextBeginPath(UserGraphBuff);
CGContextAddLineToPoint(UserGraphBuff, (*xVal)[sizeof xVal / sizeof *xVal - 1], (*yNewVal)[sizeof yNewVal / sizeof *yNewVal - 1]);
for (int i = sizeof xVal / sizeof *xVal - 1; i > -1; i--){
CGContextAddLineToPoint(UserGraphBuff, (*xVal)[i], (*yNewVal)[i]);
}
CGContextEOFillPath(UserGraphBuff);
Above is the code I'm trying to work with. It should do what CGContext says, but I don't understand anything.
I keep getting this error:
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextSetRGBStrokeColor: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextSetLineWidth: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextBeginPath: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextAddLineToPoint: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextDrawPath: invalid context 0x0
I reference CGContextRef in my header file.
I don’t think that I understand CGContext well and don’t know what CGContextRef should be.
source
share