生成随机颜色
float red = (float)(arc4random() % 255)/255.0;
float blue = (float)(arc4random() % 255)/255.0;
float green = (float)(arc4random() % 255)/255.0;
view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
或使用此
每次都改变视图背景是唯一的颜色
for(int i=0;i<100;i++) {
float red = (float)(arc4random() % 255)/255.0;
float blue = (float)(arc4random() % 255)/255.0;
float green = (float)(arc4random() % 255)/255.0;
view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
}
答案 0 :(得分:0)
它将为您生成随机颜色:
onStop()