美文网首页
iOS常用的宏定义

iOS常用的宏定义

作者: keelZJP | 来源:发表于2017-07-19 13:13 被阅读6次

    #define UIColorFromRGB(rgbValue) [UIColor  colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0  green:((float)((rgbValue & 0xFF00) >> 8))/255.0  blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

    #define UIColorFromRGBA(rgbValue) [UIColor  colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0  green:((float)((rgbValue & 0xFF00) >> 8))/255.0  blue:((float)(rgbValue & 0xFF))/255.0 alpha:0.7]


    #define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

    #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() ==UIUserInterfaceIdiomPhone)


    #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)

    #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)

    #define kIOSVersions [[[UIDevice currentDevice] systemVersion] floatValue] //获得iOS版本

    #define kUIWindow    [[[UIApplication sharedApplication] delegate] window] //获得window

    相关文章

      网友评论

          本文标题:iOS常用的宏定义

          本文链接:https://www.haomeiwen.com/subject/otdlkxtx.html