Is there a specific Xcode compiler flag that gets set when compiling for iPad?

后端 未结 6 1488
無奈伤痛
無奈伤痛 2020-12-01 18:43

Is there a specific Xcode compiler flag that gets set when compiling for iPad?

I want to conditionally compile iPad vs iPhone/iPod Touch code for example:

         


        
6条回答
  •  甜味超标
    2020-12-01 19:20

    Or -> just to be sure

    -(BOOL)isDeviceAniPad
    {   
    #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200
     BOOL deviceIsPad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
     return deviceIsPad;
    #endif
     return NO;
    }
    

提交回复
热议问题