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

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

    Instead of using compile-time flags, you should use run-time check e.g. use NSClassFromString to see if a class exists because the same app can be installed on both devices.

    And because of the possibility of running the app in both devices, there isn't a built-in compile-time check whether it targets iPad or not.

提交回复
热议问题