判断设备类型是iPhone还是iPad

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

 {

NSLog(@"ipad----------");

 }else 

 {

NSLog(@"iphone----------");

 }


如果这段代码不起作用的话, 那么一定要注意一个问题, 在Target->Targeted Device Family的值改为iPhone/iPad .  这样这段代码才起作用!

你可能感兴趣的:(UI,user,iPhone,ipad,interface)