#import <UIKit/UIKit.h>
@interface UIColor (RandomColor)
//随机颜色
+ (UIColor *)randomColor;
@end
#import "UIColor+RandomColor.h"
@implementation UIColor (RandomColor)
+ (UIColor *)randomColor {
return [self colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1.0];
}
@end
时间: 2024-10-01 04:57:52