Swift版本的Objective C Macro:IS_IPHONE5

时间:2015-04-27 10:47:09

标签: iphone xcode swift

我需要快速版本的Obj.C Macro

#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

#define IS_IPHONE5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0f)

1 个答案:

答案 0 :(得分:1)

class代码

之外定义这些内容
let IS_IPHONE = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone
let IS_IPHONE5 = IS_IPHONE && UIScreen.mainScreen().bounds.size.height == 568.0