実行速度に小さな問題があります。ロード時に、少なくとも 1000 ポイントを含む CGMutablePath を生成します。画面上でこのパスをスクロールしたいので、次のようなコードを使用します。
-(void) drawRect:(CGRect)rect {
/*
Here, I have a timer calling drawRect 60 times per second.
There's also code for the scale and currentTime, based on
an MP3 playback (AVAudioPlayer);
*/
CGContextRef ref = UIGraphicsGetCurrentContext();
CGContextClearRect(ref, [self frame]);
CGContextSaveGState(ref);
CGContextTranslateCTM(ref, s.width/2+currentTime, 1);
CGContextScaleCTM(ref, scale, 1);
CGContextAddPath(ref, myGraphPath);
CGContextSetRGBFillColor(ref, .1, .1, .1, .8);
CGContextFillPath(ref);
CGContextRestoreGState(ref);
}
問題は、少し遅いことですが、それほど多くはありませんが、グラフィックコードをさらに追加する必要があるため...デバイスがパス全体を描画しているかどうか疑問に思っていました(スケールが適用されると、パスは幅約 10.000 ピクセル)、または画面に表示されている部分だけですか? これを最適化するにはどうすればよいですか?