本文介绍了如何使用动画UIImageView捕获iPhone屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIImageView放置在视图上,我想在该UIImageView动画时捕获iPhone屏幕.

I have a UIImageView placed over a view and I want to capture iPhone screen while that UIImageView is animating.

我可以成功捕获UIImageView的静止帧的屏幕截图,如下所示:

I can successfully capture the screen shots of the still frames of the UIImageView like this:

[[myView layer] renderInContext:context];

但是,当UIImageView设置动画动画时

However when the UIImageView is animating throguh

[MyImageView startAnimating]

然后,没有捕获那些动画帧.

then, those animating frames are not captured.

renderInContext是否有可用的替代方法同时捕获动画帧?

Is there any alternative to renderInContext available at the moment that can capture the animating frames as well?

注意:我知道iOS4更新后Apple不再接受UIGetScreenImage().

NOTE: I know UIGetScreenImage() is no longer accepted by Apple after iOS4 update.

推荐答案

CALayers在动画制作时使用presentationLayer表示图层的当前状态. CALayer -presentationLayer 方法将为您返回表示层.因此,您可能想尝试 [[[[myView layer] presentationLayer] renderInContext:context]; 来捕获其内容.

CALayers use a presentationLayer to represent the current state of the layer while animating. CALayer's -presentationLayer method returns you the presentation layer. So you might want to try [[[myView layer] presentationLayer] renderInContext:context]; to capture its contents.

这篇关于如何使用动画UIImageView捕获iPhone屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 20:59