在我的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