在iOS 8上调用drawViewHierarchyInRect:afterScreenUpdates时如何防止闪存?

iam*_*mer 13 iphone ipad ios ios8

在iOS 8下调用UIView的

[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
Run Code Online (Sandbox Code Playgroud)

导致图像的1帧闪烁.你可以在屏幕上看到它一瞬间.它仅在afterScreenUpdates参数为YES时发生.

这是我拍摄截图的完整代码:

UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, sf);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGContextConcatCTM(ctx, [self.layer affineTransform]);

if ([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { // iOS 7+
    [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
} else { // iOS 6
    [self.layer renderInContext:ctx];
}

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

CGContextRestoreGState(ctx);
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)

有解决方法吗?

Sar*_*dag 6

提供用于iPhone6和iPhone6 plus的@ 3x启动图像,这个问题就消失了.