UI_USER_INTERFACE_IDIOM
macro. Only SDKs 3.2 an later support it. Here an example:if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
NSLog(@"I'm on iPad");
}
In the same way:
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone) {
NSLog(@"I'm on iPhone or on an iPod touch");
}
The macro uses the
[[UIDevice currentDevice] userInterfaceIdiom]
method. If you are sure that your SDK supports the userInterfaceIdiom selector, you can also use something like this:[[UIDevice currentDevice] userInterfaceIdiom]==UIUserInterfaceIdiomPad
No comments:
Post a Comment