One of the basic ways to interact with the hardware on the device is to retrieve data about the device itself. In iOS, the device is represented by the
UIDevice class, which contains information about the device itself, such as its assigned name, operating system version, and device model (iPad, iPhone, iPod touch). The class also can tell you the orientation of the device (portrait and landscape) and provide status on the battery and the proximity sensor (whether the phone is close to the face of the user).
Listing 14.1 shows some of the ways you can use the
UIDevice class. Later sections in this chapter contain other examples of interacting with this data.