Controls are graphical objects used by the user of the application to express his/her objective. For example, a slider control can be used by the user as a way to fine tune a specific value. A switch control, on the other hand, can be used to turn on/off an option. In this chapter, we present several important graphical controls that can be used in building attractive iPhone applications.
We will cover the main graphical controls available, and their usage. Before we begin talking about specialized controls, let's understand the base class for all controls,
UIControl, and the important target-action mechanism.
Controls are subclasses of the
UIControl class. The
UIControl class position in the class hierarchy is shown in Fig. 5.1. The common behavior of controls is captured by this class. Therefore, understanding this class is essential to using its concrete subclasses such as
UITextField, UISlider, UIDatePicker, etc.
As a superclass of controls, the
UIControl class has several shared attributes that can be configured using accessor methods. These attributes include:
enabled. This is a Boolean attribute that represents whether the control is enabled or not. The property is defined as:
@property(nonatomic, getter=isEnabled) BOOL enabled
If the value for
NO, the user's touch events are ignored.
highlighted. This Boolean value controls whether the control is highlighted or not. By default, the value is
NO. When ...