How to capture iPhone screen with animating UIImageView?

烂漫一生 提交于 2020-01-14 18:46:28

问题


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

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

[[myView layer] renderInContext:context];

However when the UIImageView is animating throguh

[MyImageView startAnimating]

then, those animating frames are not captured.

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

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


回答1:


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.



来源:https://stackoverflow.com/questions/4498135/how-to-capture-iphone-screen-with-animating-uiimageview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!