1

次のコードは、ios6 で期待どおりに機能しました (カスタム UIView の drawRect メソッドで線グラフを描画しています)。

//evaluate if the cross is inside the envelope
        BOOL crossIsInside  = CGPathContainsPoint(envelopePath, NULL, CGPointMake(crossX, crossY), NO);
        CGContextSetStrokeColor (cgx, (crossIsInside) ? CGColorGetComponents([[UIColor greenColor]CGColor]) :
                                                        CGColorGetComponents([[UIColor redColor]CGColor]));


        // draw an X
        CGContextMoveToPoint(cgx, crossX-crossSize, crossY-crossSize);
        CGContextAddLineToPoint(cgx,crossX+crossSize, crossY+crossSize);
        CGContextMoveToPoint(cgx, crossX-crossSize, crossY+crossSize);
        CGContextAddLineToPoint(cgx,crossX+crossSize, crossY-crossSize);
        CGContextDrawPath(cgx, kCGPathStroke);

最初の評価は機能しますが、線は黒くなります (赤や緑ではありません)。

何か案は?

ありがとう!

4

0 に答える 0