It’s no secret that games such as the wildly popular Flight Control that allow a user to define a path, and then have an object follow that path have done well in the iOS app store. Rightly so as these games allow users to interact with the game in a way that just wasn’t possible before the iPhone arrived.
I’ve mentioned Core Animation in the past, and recently came across an excellent tutorial displaying how to create a path with core animation, and create graphical objects that follow along that path.
Here’s a video of that tutorial in action:
The trick is to define a UIBezierPath, and use a CAKeyFrameAnimation which allows your layer to follow that path. Full details can be found on the Mike Nachbaur’s site along with downloadable code:
Animating Interfaces With Core Animation Part 4
Definitely worth checking out if you were looking for a relatively easy way to do this.
©2011 iPhone, iOS 4, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.
.