主页 iOS生成随机颜色代码
Post
Cancel

iOS生成随机颜色代码

1
2
3
4
	CGFloat hue = ( arc4random() % 256 / 256.0 );  //  0.0 to 1.0
    CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5;  //  0.5 to 1.0, away from white
    CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5;  //  0.5 to 1.0, away from black
    UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
该博客文章由作者通过 CC BY 4.0 进行授权。

iOS获取各种文件目录的路径

iOS 11 新技能