Cover by Vandad Nahavandipoor

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 15. Graphics and Animations

15.0. Introduction

You’ve certainly seen applications with beautiful graphics effects on iPhones or iPads. And you’ve probably also encountered impressive animations in games and other apps. Working together, the iOS runtime and Cocoa programming frameworks make possible an amazing variety of graphics and animation effects with relatively simple coding. The quality of these graphics and animations depends partly, of course, on the aesthetic sensitivities of the programmer and artistic collaborators. But in this chapter, you’ll see how much you can accomplish with modest programming skills.

I’ll dispense with conceptual background, preferring to introduce ideas such as color spaces, transformation, and the graphics context as we go along. I’ll just mention a few basics before leaping into code.

In Cocoa Touch, an app is made up of windows and views. An app with a UI has at least one window that contains, in turn, one or more views. In Cocoa Touch, a window is an instance of UIWindow. Usually, an app will open to the main window and the programmer will then add views to the window to represent different parts of the UI: parts such as buttons, labels, images, and custom controls. All these UI-related components are handled and drawn by UIKit.

Some of these things might sound relatively difficult to understand, but I promise you that as we proceed through this chapter, you will understand them step-by-step with the many examples I will give.

Apple has ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required