Chapter 6. Creating Graphical User Interfaces

Although AppKit contains a lot of classes, for a variety of purposes, a significant proportion of the framework is responsible for creating graphical user interfaces. This chapter will explore the concepts behind Cocoa GUIs and some of the classes used to create them.

6.1 Positioning Views

Cocoa, like most other GUI toolkits, uses a Cartesian coordinate system for drawing. Points are described by the NSPoint structure, which contains two CGFloats; either floats or doubles, depending on whether you are on a 32- or 64-bit system. This structure has the same layout as the CGPoint structure, and the two can be used mostly interchangeably.

Get Cocoa® Programming Developer’s Handbook, Second 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.