随机颜色

2019-05-10  本文已影响0人  ljzza
 self.view.backgroundColor = [UIColor randomColor];
//随机颜色
+(UIColor*)randomColor
{
    NSInteger aRedValue =arc4random() %255;
    NSInteger aGreenValue =arc4random() %255;
    NSInteger aBlueValue =arc4random() %255;
    UIColor *randColor = [UIColor colorWithRed:aRedValue /255.0f green:aGreenValue /255.0f blue:aBlueValue /255.0f alpha:1.0f];
    return randColor;
}
上一篇 下一篇

猜你喜欢

热点阅读