Universal Apps concept for iPhone and iPad

孤人 提交于 2019-12-06 15:04:46

Your above method is actually how I determine devices in some of my apps as well.

I actually recently wrote a little piece on this issue.

You can also use:

#define IDIOM    UI_USER_INTERFACE_IDIOM()
#define IPAD     UIUserInterfaceIdiomPad
#define IPHONE   UIUserInterfaceIdiomPhone

if ( IDIOM == IPAD ) 
    NSLog(@"Device is iPad.");
else 
    NSLog(@"Device is iPhone or iPod touch.");

or

if ( [[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"] ) 
{
    NSLog(@"Device is an iPod touch");
    /*  same goes for "iPhone", "iPad" etc.  */
}
jopke

I have 3 sets of classes:

  • base classes: this is where the shared logic goes
  • iPhone classes: iPhone specific logic including UI goes here
  • iPad classes: iPad specific logic, including UI goes here

I have as much as possible in the base classes, but for the times when the logic is separate, it is much easier to have the distinct classes. Digging through the code looking for the exceptions would be a pain, IMO.

I found this blog helpful (not mine)

Rams

Its not a problem . you have to create a universal app.

File--->New Project--->windowsapplication

and then choose a product Universal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!