将iPhone 5添加到预先存在的通用应用程序

时间:2012-12-05 05:06:52

标签: objective-c ios ios5 cocos2d-iphone

我有以下预处理器代码来检测设备是iPhone还是iPad,我想要添加iPhone5:

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

#define POS_UI_CHEST  ( (IS_IPAD) ? (ccp(72.0,831.0)) : (ccp(33.0,396.0)) )
#define POS_UI_ROUTE  ( (IS_IPAD) ? (ccp(74.0,521.0)) : (ccp(36.0,240.0)) )
#define POS_UI_GUAGE  ( (IS_IPAD) ? (ccp(384.0,70.0)) : (ccp(160.0,20.0)) )
#define POS_UI_BALL   ( (IS_IPAD) ? (ccp(384.0,70.0)) : (ccp(160.0,20.0)) )

为每个条件添加第三个ccp的最简单方法是什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

你能窝吗? :运营商本身:

#define POS_UI_CHEST ( IS_IPAD ? ccp(72.0,831.0) : (IS_IPHONE5 ? ccp(xxx.0,yyy.0) : ccp(33.0,396.0)) )

(我删除了(不必要的(括号(for))((清晰度)))

您可以找到macros for iPhone 5 detection on stackoverflow