snapshotViewAfterScreenUpdates iOS 8上的故障 [英] snapshotViewAfterScreenUpdates glitch on iOS 8

查看:165
本文介绍了snapshotViewAfterScreenUpdates iOS 8上的故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've noticed running this would cause view (or main window, not sure) to resize for a moment, when running on iPhone 6/6+ simulator scaled from iPhone 5 layout (without passing launch image for iPhone 6/6+):

[self.view snapshotViewAfterScreenUpdates:YES];

当你不能在那里传递'NO'时,有什么想法让它工作吗?

Any idea how to make it work when you can't pass 'NO' there?

更新(7月13日):

似乎不再在iOS 8.4上重现。

Update (Jul 13th):
Does not seem to reproduce on iOS 8.4 anymore.

推荐答案

由于它似乎是一个Apple / API问题,我只是决定在需要传递YES时不使用该方法。

Since it seemed like an Apple/API problem, I just decided to not use that method when I need to pass a "YES."

您可以只截取视图的截图(UIImage)并将其放在UIImageView中,作为您从快照方法中获取的UIView。

You can just take a screenshot (UIImage) of your view and place it in a UIImageView to act as the "UIView" you used to get from the snapshot method.

以下是代码链接:
如何在不损失视网膜显示质量的情况下将UIView捕获到UIImage上

#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;
}

这篇关于snapshotViewAfterScreenUpdates iOS 8上的故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆