UIDevice class provides a Singleton instance representing the current device. From this instance you can obtain information about the device such as assigned name, device model, and operating-system name and version.
- iOS 2.0+
- tvOS 9.0+
You also use the
UIDevice instance to detect changes in the device’s characteristics, such as physical orientation. You get the current orientation using the
orientation property or receive change notifications by registering for the
UIDevice notification. Before using either of these techniques to get orientation data, you must enable data delivery using the
begin method. When you no longer need to track the device orientation, call the
end method to disable the delivery of notifications.
Similarly, you can use the
UIDevice instance to obtain information and notifications about changes to the battery’s charge state (described by the
battery property) and charge level (described by the
battery property). The
UIDevice instance also provides access to the proximity sensor state (described by the
proximity property). The proximity sensor detects whether the user is holding the device close to their face. Enable battery monitoring or proximity sensing only when you need it.
Starting in iOS 4.2, you can use the
play instance method to play keyboard input clicks in custom input and keyboard accessory views.