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

后端 未结 6 1489
無奈伤痛
無奈伤痛 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:26

    I think this will do

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

提交回复
热议问题