我有iPad应用程序需要每秒捕获4次视图内容并保存为图像。我使用CALayer renderInContext方法,在iPad2上一切正常,但问题出在iPad4上。可能呈现视网膜分辨率会导致不良表现。任何想法如何提高渲染速度?一种可能的解决方案是降低比例因子,但是它没有给出想要的结果。想法?
编辑:
- (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];
}