Johannes Harestad


Custom loading animation for iOS

I came a cross a bunch of links for CSS Loading Animations. This one seemed rather useless but funny.

Being new to iOS and learning the Cocoa-touch framework(s) I wanted to challenge my self to make a similar loading animation on iOS :)

Skjermbilde 2014-03-29 kl. 13.12.18.png

I solved this by setting up a path for each object to move along with UIBezierPath and CAKeyframeAnimation.

First. Create a new project, a Single View Application will do. Let’s name it FancyLoadingAnimation.

Skjermbilde 2014-03-29 kl. 11.13.03.png

Open Main.storyboard and add a button somewhere on the View. By default Xcode should also have created a ViewController as the Custom Class for the first ViewController in the Storyboard. If you click on ViewController in the dock, you can see under the Identity Inspector that the Custom Class is set to “ViewController”.

Skjermbilde 2014-03-29 kl. 11.21.00.png

Hide the dock and right-side panel to get more space. Then ⌥ (ALT) + Click the ViewController.m file. Both the...

Continue reading →