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 ...
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.
Read now
Unlock full access