Chapter 10. Advanced UI Kit Design

Chapter 3 introduced the UI Kit framework, which is at the heart of all GUI applications on the iPhone. This chapter covers the more complex and aesthetically rich components of the iPhone's user interface framework and shows you some advanced techniques to make your own software look as spectacular as Apple's own preloaded applications.

The following advanced components of UI Kit will be covered:



Common controls

UI Kit provides a set of controls that include switches, buttons, segmented controls, sliders, and more. Controls are used in navigation bars, table cells, and with other visual elements. The UIControl class is the base class for controls, providing standardized events notification, display properties, and values.



Preferences tables and section lists

The UITableView class you were introduced to in Chapter 3 supports alternative layouts to display preferences tables and section lists. Preferences tables are used for managing grouped program settings or displaying structured information. Section lists present a Rolodex-style fashion list of contacts, music, or other indexed data.



Progress and activity indicators

Progress indicators notify the user that an operation is in progress and convey status in the form of spinning icons and thermometers. The application can tell the indicator when to start and stop, and can control the progress bar's completion.

Activity indicators show the user that an activity is in progress. The application can indicate when it is using the network or provide general indicators instructing the user to wait.



Images

UI Kit provides classes for the manipulation and display of images. These classes can load most popular types of images and display, transform, layer, and clip them anywhere on the screen. Image classes can also be animated.



Text field keyboard properties

The iPhone supports several different keyboard styles, which are used widely by applications for various kinds of input. Apple's Mail application invokes a keyboard containing special characters for email address entry, whereas Safari invokes a different keyboard suitable for URL input, sporting a .COM button. Text fields contain special properties to define the style of keyboard that appears when typing.



Date pickers and picker views

Pickers provide a unified method of input for selecting options from a list. Pickers present lists in the form of spinning dials, which you can tailor to behave in different ways. Date and time pickers are more specialized controls, allowing the selection of custom dates, times, and time periods.



Tab bars

Tab bars provide a series of shortcut buttons across the bottom of the iPhone's screen, allowing the programmer to logically group the primary functions of an application. This is also a popular method to separate views of different data. The iPod application uses tab bars to separate playlists, artists, songs, and videos from each other, while the phone application uses a button bar to provide shortcuts to different functions of the phone, such as the keypad and contacts list.



Sensors and device information

The iPhone includes many sensors, such as the accelerometer and proximity sensor. Other sensors, such as the orientation sensor, are used internally to automatically manage screen rotation. The UIDevice class also allows you to read certain operating system-level information, such as the device's model, software version, and unique identifier. In this section, you'll learn how to read and make sense of the different indicators available on the iPhone.



Scroll views

Many objects with large content depend on scroll views to render them. Scroll views allow content to be scrolled into view and zoomed. You've been using them indirectly with tables and lists, and here you'll see just how they work.



Web views

A web view class is built into the UI Kit framework, allowing applications to display a web page. This is powerful for network-based tools that might choose to use web pages to refresh "latest news" windows or display other information. Web views can also display small PDFs and images.