Structures within Structures

Objective-C provides an enormous amount of flexibility in defining structures. For instance, you can define a structure that itself contains other structures as one or more of its members, or you can define structures that contain arrays.

You learned about the typedef statement in Chapter 10, “More on Variables and Data Types.” In your iOS programs, you will often need to work with rectangles. Rectangles define the size and location of a window on an iPhone’s or iPad’s screen, for example. They also define the location and size of subwindows (or what are called subviews). There are three basic data types that are used and are defined using typedef:

1. CGPoint, which describes an (x,y) point

2. CGSize, which describes ...

Get Programming in Objective-C, Sixth 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.