Skip to Main Content
iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch
book

iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch

by Maher Ali
March 2009
Beginner to intermediate content levelBeginner to intermediate
396 pages
8h 44m
English
Wiley
Content preview from iPhone SDK Programming: Developing Mobile Applications for Apple iPhone and iPod touch

Chapter 4. The View

This chapter explains the main concepts behind views. You will learn about view geometry in Section 4.1. In Section 4.2, we cover the topic of view hierarchy. Next, Section 4.3 discusses, in great detail, the multitouch interface. In this section, you will learn how to recognize multitouch gestures. After that, we discuss several animation techniques in Section 4.4. Finally, Section 4.5 deals with how to use Quartz 2D functions for drawing inside a view.

View Geometry

There are three geometric properties of the UIView class that you need to understand. These properties are: frame, bounds, and center. Before explaining these properties, let's first look at some of the structures and functions used in specifying the values for these properties.

Useful geometric type definitions

The following types are used throughout the text:

  • CGFloat represents a floating 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 the y value represents its y-coordinate.

    You will use CGPoint a lot. CGPointMake() is a convenient function defined to make a CGPoint from a pair of x and y values, and is defined as follows:

    CGPoint CGPointMake (
       CGFloat x,
       CGFloat y
    );
  • CGSize is a structure used to represent width and height values, and is declared as follows:

    struct CGSize { CGFloat width; CGFloat height; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Office Access 2007 on Demand

Microsoft® Office Access 2007 on Demand

Steve Johnson - Perspection, Inc.
FileMaker Pro 14: The Missing Manual

FileMaker Pro 14: The Missing Manual

Stuart Gripman, Susan Prosser
Microsoft® Office Access™ 2007 Step by Step

Microsoft® Office Access™ 2007 Step by Step

Steve Lambert Joan Lambert and M. Dow Lambert III

Publisher Resources

ISBN: 9780470742822Purchase book