self.view.backgroundColor=[UIColor colorWithRed:(arc4random()%255)/256 green:(arc4random()%255)/256 blue:(arc4random()%255)/256 alpha:(arc4random()%255)/256];
self.view.backgroundColor=[UIColor colorWithHue:(arc4random()%255)/256 saturation:(arc4random()%128)/256+0.5 brightness:(arc4random()%128)/256+0.5 alpha:1];
这两个这么写对么,但是只出来一种颜色,他们两个区别是什么,怎么实现背景颜色的闪变呢?
NSTimer *timer =[NSTimer scheduledTimerWithTimeInterval: 0.1 target:self selector:@selector(bigcolor)userInfo:nil repeats:YES];
[timer fire];
-(void)bigcolor
{
self.view.backgroundColor=[UIColor colorWithRed:(float)(arc4random()%255)/256 green:(float)(arc4random()%256)/256 blue:(float)(arc4random()%255)/256 alpha:1];
}