Last active
September 17, 2019 08:07
-
-
Save WymanY/e06f08272e7523832e2b14cd1dba86fa to your computer and use it in GitHub Desktop.
[Random Color 快捷]OC快速的创建randomColor 分类。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIColor (random) | |
+ (UIColor *)ramdomColor; | |
@end | |
@implementation UIColor (random) | |
+ (UIColor *)ramdomColor { | |
int r = rand() % 255; | |
int g = rand() % 255; | |
int b = rand() % 255; | |
return [UIColor colorWithRed:r/255.f green:g/255.f blue:b/255.f alpha:1]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment