在我的Xcode我有一个UIView是动态随机颜色的UIView
UIView *gaping=[[UIView alloc] initWithFrame:CGRectMake(15, 0, 172, 39)];
gaping.backgroundColor= [UIColor redColor];
我需要的背景色为动态变化。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UIView *gaping=[[UIView alloc] initWithFrame:CGRectMake(15, 0, 172, 39)];
gaping.backgroundColor= [UIColor redColor];
UITableViewCell *TableCell = [[UITableViewCell alloc] init];
NSMutableDictionary *RRTYRT = [DATAARRAY objectAtIndex:indexPath.row];
UILabel *LabelOne = [[UILabel alloc] initWithFrame:CGRectMake(45, 0, 100, 30)];
LabelOne.textColor = [UIColor whiteColor];
LabelOne.backgroundColor = [UIColor clearColor];
LabelOne.text = [RRTYRT objectForKey:@"themename"];
[gaping addSubview:LabelOne];
[gaping.layer setCornerRadius:5.8f];
[TableCell.contentView addSubview:gaping];
return TableCell;
}
下面提到的代码是在其内我有此视图和用于实现代码如下的每个小区i需要更改此UIView的颜色的表格视图。我知道它的理解有点混乱,所以如果任何人都可以帮助我的话,那将是不可取的。
感谢
**非常非常糟糕的命名约定** –
其中是随机颜色,对于每个cellview它具有相同的“白色”颜色。 –
无法理解 – Sport