开发者

iphone - Detecting what type of simulator

开发者 https://www.devze.com 2023-02-18 13:29 出处:网络
how can I detect whether I\'m using iphone simulator or ipad simulator. I\'m using some 3rd party library to which I\'ve to pass a parameter whether i\'m using ipad or iphone. in order to test the app

how can I detect whether I'm using iphone simulator or ipad simulator. I'm using some 3rd party library to which I've to pass a parameter whether i'm using ipad or iphone. in order to test the app, i want to programatically detect whether i'm using iphone simulator or ipad simulator. is there any way to ident开发者_JAVA百科ify it?


if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  // iPad code
}
else {
  // iPhone code
}


did you tried [[[UIDevice currentDevice] model] hasPrefix: @"iPad"]

0

精彩评论

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

关注公众号