Skip to content

Instantly share code, notes, and snippets.

@WymanY WymanY/randomColor.m
Last active Sep 17, 2019

Embed
What would you like to do?
[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
You can’t perform that action at this time.