//随机色方法
- (UIColor *)randomColor
{
static BOOL seeded = NO;
if(!seeded) {
seeded = YES;
srandom((unsigned)time(NULL));
}
CGFloat red = (CGFloat)random()/(CGFloat)RAND_MAX;
CGFloat blue = (CGFloat)random()/(CGFloat)RAND_MAX;
CGFloat green = (CGFloat)random()/(CGFloat)RAND_MAX;
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0f];
}
在用到背景色的地方直接调用就ok了!