In development sometimes we need to know some basic information about the current device, such as: iphone or ipad, phone model, etc., Apple provides us with the Uidevice class, which provides some important properties related to the device, we can learn some details of the system.
The Uidevice class is designed to be a singleton class that is easy to share and not wasteful to use. How to use: [Uidevice Currentdevice] obtains the Uidevice Singleton and then accesses its properties.
Common Properties:
SystemName------Get the name of the operating system
Systemversion-------Get the version of the current system
Model------Get the type of device
USERINTERFACEIDIOM------The interface style of the device. (For now, it's iphone,ipad/ipod touch)
Name-------The names of the devices in itunes
Simple case:
A project needs to develop the iphone and ipad version, the project analysis found that the difference is only in the interface layer, business logic, data model, and so on, so build a project, only in the V,C layer to do a different treatment on the line. At this point, you need to determine the current device.
Common practices define a macro to use
#define IS_IPAD (ui_user_interface_idiom () = = Uiuserinterfaceidiompad)
Ui_user_interface_idiom () is a very convenient macro in Uikit, its internal implementation is implemented with the Uidevice class, to distinguish the current device
Basic information on iOS access devices