Universal application

跟風遠走 提交于 2019-11-30 10:32:49

in Xcode 3

select your target in Xcode, right-click and use the “Upgrade Current Target for iPad…” command.

in Xcode 4

click on the project and go to the target. In Summary tab, change Device to Universal.

I used

UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad

for detecting iPad.

The easiest way would be using UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad and UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone.

Personnally, I used this method in my appdelegate

+ (BOOL)isPad
{
    NSLog(@"--------- %@ ---------", [[UIDevice currentDevice] model]);
    NSRange range = [[[UIDevice currentDevice] model] rangeOfString:@"iPad"];
    return !(range.location==NSNotFound);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!