ビューのコンテンツを毎秒4回キャプチャして画像として保存する必要があるiPadアプリケーションがあります。CALayer renderInContext メソッドを使用し、iPad2 ではすべて問題ありませんが、問題は iPad4 にあります。おそらく網膜解像度をレンダリングすると、パフォーマンスが低下します。レンダリング速度を改善する方法はありますか? 考えられる解決策の 1 つは、スケール ファクターを下げることですが、期待どおりの結果が得られません。アイデア?
編集:
- (void) drawRect:(CGRect)rect {
if (_recording) {
UIGraphicsBeginImageContext(self.bounds.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* renderedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self performSelectorInBackground:@selector(writeImageToDisk:) withObject:renderedImage];
}
//redraw at the specified framerate
[self performSelector:@selector(setNeedsDisplay) withObject:nil afterDelay:0.25];
}