Figure 10-1: The coordinate system.
Understanding Animation on the iPad
Fortunately, most of what you need to do as far as iPad animation is concerned is already built into the framework. Some view properties can be animated (the center point, for example), which means that you just need to tell the view where to start, where to end, and a few other optional parameters, and you’re done. The view itself (in the UIView
base class) has the functionality to animate the move. To give you some context in which to understand how animation on the iPad works, however, I need to explain what goes on under the hood when a framework takes care of the animation chores for you. More specifically, I need to delve a bit deeper into views, their properties, and the coordinate systems on the iPad.
View geometry and coordinate systems
The default coordinate system in UIKit
places its origin in the top-left corner and has axes that extend down and to the right from the origin point. Coordinate values are represented using floating-point numbers, and you don’t have to worry about the screen resolution; the frameworks take care of that automatically. Figure 10-1 shows this coordinate system relative to the screen. In addition to the screen coordinate system, views define their own local coordinate systems that allow you to specify coordinates relative to the view instead of relative to the screen.
Get iPad Application Development For Dummies, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.