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

前端之家收集整理的这篇文章主要介绍了调用drawViewHierarchyInRect时如何防止闪存:afterScreenUpdates:在iOS 8?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在iOS 8下调用UIView的
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];

导致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();

解决方法吗?

@H_404_13@解决方法
提供@ 3x启动图像以在iPhone6和iPhone6加上使用,这个问题消失了.
原文链接:https://www.f2er.com/iOS/335994.html

猜你在找的iOS相关文章