Search code examples
objective-cxcodecocoauiimagescreenshot

How to animate an image onto the screen


I am new to Objective-C and I want to let a screenshot made with

CGSize imageSize = [[UIScreen mainScreen] bounds].size;
...
UIGraphicsBeginImageContext(imageSize);
...
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

"fly in" (rotating and stoping in random angle) inside an own image container, looking like a small photo (shadow, white border). how could I realize that?


Solution

  • Since you have a vague question - and your code shows only how you are getting the screen image - here's a general answer.

    • Put the image on a CAImageLayer
    • Add a border or a shadow or whatever other chrome you need to your image layer (or on another layer underneath it)
    • Use Core Animation to animate this CAImageLayer to whatever position or state you want it to be in.