Chapter 5. The View
This chapter explains the main concepts behind views. You learn about view geometry in Section 5.1. In Section 5.2, we cover the topic of view hierarchy. Next, Section 5.3 discusses, in great detail, the multitouch interface. In this section, you learn how to recognize multitouch gestures. After that, we discuss several animation techniques in Section 5.4. Next, Section 5.5 deals with how to use Quartz 2D functions for drawing inside a view. Finally, we summarize the chapter in Section 5.6.
View Geometry
This section covers the three geometric properties of the UIView
class that you need to understand: frame, bounds
, and center
. Before explaining these properties, let's first look at some of the structures and functions used in specifying their values.
Useful geometric type definitions
The following types are used throughout the text:
CGFloat
represents a floating point number and is defined as:typedef float
CGFloat;CGPoint
is a structure that represents a geometric point. It is defined as:struct
CGPoint { CGFloat x; CGFloat y; };typedef struct
CGPoint CGPoint;The
x
value represents the x-coordinate of the point and they
value represents its y-coordinate.You will use
CGPoint
a lot.CGPointMake
() is a convenient function defined to make aCGPoint
from a pair ofx
andy
values, and is defined as follows:CGPoint CGPointMake ( CGFloat x, CGFloat y );
CGSize
is a structure used to represent width and height values. It is declared as follows:struct
CGSize { CGFloat width; ...
Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.