我们可以为UIcolor添加一个category方便使用
+ (UIColor *)randomColors{
return [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1.0];
}
就是这么简单!!!
本文介绍了一个简单的UIColor类别方法,用于生成随机颜色。通过这个方法,开发者可以轻松地为UI元素添加多彩的效果。
我们可以为UIcolor添加一个category方便使用
+ (UIColor *)randomColors{
return [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 / 255.0 blue:arc4random() % 256 / 255.0 alpha:1.0];
}

被折叠的 条评论
为什么被折叠?