gpt4 book ai didi

ios - iOS 8 上的 snapshotViewAfterScreenUpdates 故障

转载 作者:IT王子 更新时间:2023-10-29 08:03:43 25 4
gpt4 key购买 nike

我注意到运行它会导致 View (或主窗口,不确定)在从 iPhone 5 布局缩放的 iPhone 6/6+ 模拟器上运行时调整片刻(不传递 iPhone 6/6 的启动图像) +):

[self.view snapshotViewAfterScreenUpdates:YES];

当您不能在那里传递“NO”时,知道如何让它工作吗?

更新(7 月 13 日):
似乎不再在 iOS 8.4 上重现。

最佳答案

因为它看起来像是一个 Apple/API 问题,所以我只是决定在需要传递"is"时不使用该方法。

您可以截取 View 的屏幕截图 (UIImage) 并将其放在 UIImageView 中,作为您过去从快照方法获取的“UIView”。

代码链接如下: How to capture UIView to UIImage without loss of quality on retina display

#import <QuartzCore/QuartzCore.h>

+ (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return img;
}

关于ios - iOS 8 上的 snapshotViewAfterScreenUpdates 故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25873234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com