Imran Raheem
Imran Raheem

Reputation: 880

How to capture iPhone screen with animating UIImageView?

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.

Upvotes: 3

Views: 1121

Answers (1)

Björn Marschollek
Björn Marschollek

Reputation: 10009

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.

Upvotes: 5

Related Questions