How to differentiate between iphone4 and iphone 3

前端 未结 9 1388
情歌与酒
情歌与酒 2020-11-28 20:28

I am trying to build a game for the iphone using cocos2d engine. I wanted to know how can I tell a difference whether the user is using iphone 4 or iphone 3 as I wanted to l

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 20:52

    Despite what Apple's docs say, the UIScreen's scale property isn't just available in iOS4, it's also available in 3.2 on the iPad. This means it's probably an unreliable way to check which device you're on.

    Instead, you should check if contentScaleFactor is available on your main window(or any UIView), and then check the scale value.

提交回复
热议问题