Skip to content

Instantly share code, notes, and snippets.

@WymanY
Last active September 17, 2019 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WymanY/e06f08272e7523832e2b14cd1dba86fa to your computer and use it in GitHub Desktop.
Save WymanY/e06f08272e7523832e2b14cd1dba86fa to your computer and use it in GitHub Desktop.
[Random Color 快捷]OC快速的创建randomColor 分类。
@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