试图更改UITableViewCell
文本UIColour
(服装单元格)将使文本变得白色和看不见,只有当触摸UITableViewCell
时,我才能看到文本。 为什么将UIColour
设置为UITableViewCell
即不是blackColor
将不起作用?更改TableView单元格颜色将不起作用
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
if (!indexPath.row) {
NSDictionary *dic= [[GlobalData sharedGlobals].categories
objectAtIndex:indexPath.section];
cell.textLabel.text = [dic objectForKey:@"title"]; // only top row showing
cell.textLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold"
size:22];
cell.textLabel.textColor = [UIColor colorWithRed:177
green:218
blue:229
alpha:1];
//cell.textLabel.backgroundColor = [UIColor colorWithRed:218
green:241
blue:245
alpha:1];
} else {
NSMutableArray *typesOfSection =
[[GlobalData sharedGlobals].typesByCategories
objectAtIndex:indexPath.section];
NSDictionary *type = [typesOfSection objectAtIndex:indexPath.row-1];
NSString *titleOfType = [type objectForKey:@"title"];
cell.textLabel.text = titleOfType;
cell.textLabel.textColor = [UIColor colorWithRed:122
green:181
blue:196
alpha:1];
cell.textLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold"
size:22];
//cell.textLabel.text = @"check";
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
而且这样做时:
cell.textLabel.textColor = [UIColor redColor];
其工作..
谢谢,但这只是第一个被占用的单元格的颜色。有更多的细胞是空的 - 他们保持白色 – Curnelious
你可能也想改变其他颜色。试试这个[UIColor colorWithRed:177.0/255.0 green:218.0/255.0 blue:229.0/255.0 alpha:1.0]; – singingAtom