开发者

How can I get UI_USER_INTERFACE_IDIOM

开发者 https://www.devze.com 2023-04-09 19:08 出处:网络
How can I get UI_USER_INTERFACE_IDI开发者_如何学JAVAOM, I am not clear that how does it work, can anyone please guide me?if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

How can I get UI_USER_INTERFACE_IDI开发者_如何学JAVAOM, I am not clear that how does it work, can anyone please guide me?


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    // iPad device
} else {
    // iPhone / iPod touch device
}

From the Apple Header files:

/* The UI_USER_INTERFACE_IDIOM() macro is provided for use when deploying to a version of the iOS less than 3.2. If the earliest version of iPhone/iOS that you will be deploying for is 3.2 or greater, you may use -[UIDevice userInterfaceIdiom] directly. */
#define UI_USER_INTERFACE_IDIOM() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? [[UIDevice currentDevice] userInterfaceIdiom] : UIUserInterfaceIdiomPhone)
0

精彩评论

暂无评论...
验证码 换一张
取 消