我使用该[UIColor colorWithRed: green: blue: alpha: ]
功能制作了一本颜色字典。但是,当调用并显示在屏幕上时,它们看起来与实际颜色完全不同,而是类似于基本[UIColor yellowColor]
功能。是否应该包含一个库以显示 RGB 颜色的实际色调?
作为参考,这是我制作的字典:
colorStorage = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:229.0 green:43.0 blue:80.0 alpha:1.0], @"Amaranth",
[UIColor colorWithRed:225 green:191 blue:0 alpha:1.0], @"Amber",
[UIColor colorWithRed:239 green:222 blue:205 alpha:1.0], @"Almond",
[UIColor colorWithRed:205 green:149 blue:117 alpha:1.0], @"Antique brass",
[UIColor colorWithRed:0 green:128 blue:0 alpha:1.0], @"Ao",
[UIColor colorWithRed:141 green:182 blue:0 alpha:1.0], @"Apple green",
[UIColor colorWithRed:251 green:206 blue:177 alpha:1.0], @"Apricot",
[UIColor colorWithRed:135.0 green:169.0 blue:107.0 alpha:1.0], @"Asparagus",
[UIColor colorWithRed:0 green:127 blue:255 alpha:1.0], @"Azure",
[UIColor colorWithRed:225 green:32 blue:82 alpha:1.0], @"Awesome",
[UIColor colorWithRed:178 green:190 blue:181 alpha:1.0], @"Ash grey",
[UIColor colorWithRed:110 green:127 blue:128 alpha:1.0], @"AutoMetalSaurus", nil];
它们被称为:
for (id key in colorStorage){
UIButton *colorButton = [UIButton buttonWithType:UIButtonTypeCustom];
[colorButton setTitle:key forState:UIControlStateNormal];
//additional code here...
colorButton.backgroundColor = [colorStorage objectForKey:key];
colorButton.tag = i;
[self.colorPicker addSubview:colorButton];
i = i + 1;
}