我的代码出了什么问题?
- (IBAction)randomColour:(id)sender {
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];
self.Label.textColor = [UIColor color];
self.Label2.textColor = [UIColor color];
}
我已尝试初始化颜色变量和UIColor
无处不在,但我一直低于错误:
选择器'color'没有已知的类方法
即使它就在那里!
答案 0 :(得分:1)
self.Label.textColor = color; self.Label2.textColor = color;