【发布时间】:2014-10-02 18:05:37
【问题描述】:
我有一个充满 UIColors 的数组。我想将它们设置为单元格背景颜色,用作在饼图上复制颜色的键。
这是这个数组:
self.sliceColors =[NSArray arrayWithObjects:
[UIColor colorWithRed:246/255.0 green:155/255.0 blue:0/255.0 alpha:1],
[UIColor colorWithRed:129/255.0 green:195/255.0 blue:29/255.0 alpha:1],
[UIColor colorWithRed:62/255.0 green:173/255.0 blue:219/255.0 alpha:1],
[UIColor colorWithRed:229/255.0 green:66/255.0 blue:115/255.0 alpha:1],
[UIColor colorWithRed:148/255.0 green:141/255.0 blue:139/255.0 alpha:1],nil];
没关系。我正在尝试编写为单元格着色的语法。环顾四周,我发现了这个:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
}
但我不知道如何用数组中的颜色填充它。我尝试过的一切都产生了语法错误。
【问题讨论】:
-
您希望这看起来像什么?您是否希望每个单元格都具有其中一种颜色?你想让一个单元格拥有所有的颜色吗?您希望它们如何显示?
标签: ios objective-c arrays uitableview