美文网首页codeTools
2023-随机色 以及 颜色 宏定义

2023-随机色 以及 颜色 宏定义

作者: ArrQing | 来源:发表于2017-02-22 09:20 被阅读25次

随机色

CGFloat red = (float)(arc4random()%255)/256;
    CGFloat green = (float)(arc4random()%255)/256;
    CGFloat blue = (float)(arc4random()%255)/256;
    CGFloat alpha = (float)(arc4random()%255)/256;
    UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];

宏定义

#define KMainBodyColor [UIColor colorWithRed:255/255.0f green:89/255.0f blue:66/255.0f alpha:1]//navigationBar主题颜色

#define JFRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]//获取随机颜色

#define JFRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define JFRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

#define JFClearColor [UIColor clearColor]// clear背景颜色

相关文章

网友评论

    本文标题:2023-随机色 以及 颜色 宏定义

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