问题
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