'invalid context 0x0' Fehler bei der Verwendung CGContext* Funktionen

/*  Adding the Path */
UserGraphBuff = UIGraphicsGetCurrentContext();

CGContextSetRGBStrokeColor(UserGraphBuff,5,10,0,1);
CGContextSetLineWidth(UserGraphBuff, 2 );

CGContextBeginPath(UserGraphBuff);  

//line to last user point
CGContextAddLineToPoint(UserGraphBuff, (*xVal)[sizeof xVal / sizeof *xVal - 1], (*yNewVal)[sizeof yNewVal / sizeof *yNewVal - 1]);
//line to rest of user points in reverse order
for (int i = sizeof xVal / sizeof *xVal - 1; i > -1; i--){
    CGContextAddLineToPoint(UserGraphBuff, (*xVal)[i], (*yNewVal)[i]);
}

//EOFill
CGContextEOFillPath(UserGraphBuff);

Oben ist der code, den ich versuche zu arbeiten durch. Seine angeblich zu tun, was CGContext sagt, es tut, aber ich bin nicht immer jedes Ding gezogen.
Ich bekomme immer diese Fehlermeldung:

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

Ich mich auf die CGContextRef in meiner header-Datei.

ich glaube nicht, dass ich verstehen CGContext gut genug, noch weiß ich, was CGContextRef werden sollte.

Wo kommt dieser code Leben? In der drawRect einer UIView Unterklasse?
-(void)userShow{
Was zum Teufel ist das? Was tut es? Heißt es von -drawRect:?

InformationsquelleAutor John Riselvato | 2011-10-28

Schreibe einen Kommentar