-1

Does anyone know how to animation an image in Objective-C like it is done at Famous Brands (Requires Flash Player to see)

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
Divya Jain
  • 119
  • 1
  • 1
  • 9

1 Answers1

0

Take your image and slice it in parts with your favorite photo app. Create an imageView for each image and add it to a new UIView which play the role of the image container. Now add this UIView to your main view.

If you want to animate it simply iterate through all imageViews inside your container view and start the following animation:

[UIView animateWithDuration:0.3
                        delay: i * 0.3
                        options:UIViewAnimationCurveEaseInOut
                     animations:^{
                         currentImageView.alpha = 0.0;
                         currentImageView.transform = CGAffineTransformMakeScale(0.0, 1.0);
                     }
                     completion:nil
];  

Where currentImageView is the current imageView in the loop and i the iterator var.

It would be even better to slice the original Image with CoreGraphics, so you don't have to do it manually as stated above but that's a little bit more work.

yinkou
  • 5,756
  • 2
  • 24
  • 40
  • How can we do this with Coregraphics? – Divya Jain May 24 '12 at 10:41
  • You mean to cut one large image in smaller parts? In that case take a look at this: [how to crop an image into pieces](http://stackoverflow.com/questions/4743242/how-to-crop-image-in-to-pieces-programmatically) – yinkou May 24 '12 at 11:14