Chapter 3. Introduction to UIKit

UIKit is the largest iPhone framework in terms of file size, and rightly so—it’s responsible for all user interface functions from creating windows and text boxes to reading multitouch gestures and hardware sensors. All of the graphical pleasantries that make the iPhone seem easy-to-use rely on the UIKit framework to deliver a polished and unified interface. The same UIKit APIs are available to all iPhone applications, and understanding how to use this framework will allow you to take advantage of the same tools that make Apple’s own stock apps spectacular.

UIKit is more than a mere user interface kit; it is also the runtime foundation for iPhone GUI applications. When an application is launched, its main( ) function instantiates a UIApplication object within UIKit. This class is the base class for all applications having a user interface on the iPhone, and it provides the application access to the iPhone’s higher-level functions. In addition to this, common application-level services such as suspend, resume, and termination are functions of the UIApplication object.

To tap into the UIKit, your application must be linked to the UIKit framework. As a framework, UIKit is a type of shared library. So, using the compiler tool chain, UIKit can be linked to your application by adding the following arguments to the compiler arguments we described in Chapter 2:

$ arm-apple-darwin9-gcc -o MyApp MyApp.m -lobjc \
    -framework CoreFoundation \
    -framework Foundation ...

Get iPhone Open Application Development, 2nd 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.