O'Reilly logo

iOS 8 Swift Programming Cookbook by Vandad Nahavandipoor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Creating Dynamic and Interactive User Interfaces

5.0. Introduction

There are a few classes in the iOS SDK that you can use to add very interesting physics to your app to make it even more interactive. For instance, if you look at the new iOS, you’ll notice that background images that you can use as wallpapers are more lively than before because they can move and slide around as you move your device to the left, right, etc. These are some of the various behaviors that the new SDK allows you to add to your apps as well.

Let me give you another example. Let’s say that you have a photo-sharing application that runs on the iPad. On the lefthand side of the screen, you have some pictures that your app has pulled onto the screen from the user’s photo album, and on the right you have a basket-like component where every photo that is placed into the basket will be batch-shared on a social networking service like Facebook. You want to provide interactivity on your UI with an animation so that the user can flick the pictures onto the basket from the left, and the pictures will snap into the basket. This was all possible in the past, but you had to know a fair bit about Core Animation and have a rather good understanding of physics. With UI Dynamics, Apple’s new technology, a lot of these things can be attached to your apps very easily. In fact, you can attach very interesting physics and behaviors to your views with just a few lines of code.

Apple has categorized these actions into ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required