1

I'm developing an application for iPad.

I want to make nice animations so that I can beautify my application. For example, there are 4 main buttons/images in a view. When tapping on one of them, a few more buttons/images will branch out.

It's like the 'parent button' will branch out to few 'child buttons'.

How are these kind of animations done? Are there any good references or code snippets to refer to?

Thanks.

3 Answers 3

2

A good stating point would be the Core Animation demo's here:

https://github.com/neror/CA360

Run them in the iOS Simulator and checkout the code that creates the magic.

UIView animations would also be suitable for your example, and are a little easier to implement. There is a nice tutorial here:

http://www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial

1

Search on the term "Core Animation iOS" on your favorite search engine. You'll find information from Apple's Developer Central site, particularly the Core Animation Guide and Cookbook.

0
0

There are actually 2 main methods.

One is to use Core Animation, if it contains your desired path and animation.

The other is to use an animation game loop, where the app periodically calls a routine to redraw the view every frame time. An NSTimer or CADisplayLink can periodically (say at 24 or 30 or 60 Hz) call a routine doing a setNeedsDisplay, which then causes the view's drawRect to be called, etc. The some other periodic code can change some state (moving some X Y button positions, etc.) during or between each frame to provide the appearance of movement or other animation effect, when the view is redrawn. Or OpenGL can be used to redraw some animated 3D world as things move. You can even have each frame change in response to user input. This is the most flexible way to animate, and allows you to customize animations in ways that are impossible for Core Animation, but it uses more power and can be so CPU intensive as to be a lot slower than Core Animation as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.