如何捕获用于过渡的屏幕截图

Posted

技术标签:

【中文标题】如何捕获用于过渡的屏幕截图【英文标题】:How to capture the screen shot for transition 【发布时间】:2013-04-01 12:31:48 【问题描述】:

我想为图像之间的过渡截取屏幕截图。

- (UIImage *)captureView:(UIView *)view

    CGRect screenRect = [[UIScreen mainScreen] bounds];
    UIGraphicsBeginImageContext(screenRect.size);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    [[UIColor blackColor] set];
    CGContextFillRect(ctx, screenRect);
    [view.layer.presentationLayer renderInContext:ctx];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;

我在 UIImageView 播放图像过渡期间调用此方法,但是,我只是在 UIImageView 中获得静止图像,但无法捕获图像之间的过渡。 任何人都可以帮助我吗?

【问题讨论】:

【参考方案1】:

在模拟器中你可以按 3 次 shift 来减慢动画的速度,然后你也许可以捕捉到过渡。

【讨论】:

我想你误会了。他需要以编程方式进行。:) 感谢 texian,但是在按 Shift 键 3 次后我仍然无法捕捉到过渡。我错过了什么?

以上是关于如何捕获用于过渡的屏幕截图的主要内容,如果未能解决你的问题,请参考以下文章