尝试更改UITableViewCell
文字UIColour
(服装单元格)会使文字变为白色且看不见,而只有在触摸UITableViewCell
时,我才会看到文字。
为什么将UIColour
设置为不是UITableViewCell
的{{1}}不起作用?
blackColor
这样做的时候:
- (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;
}
它的工作..
答案 0 :(得分:2)
您基本上将单元格的文本颜色设置为白色。 RGB值应介于0.0和1.0之间。
试试这个
[UIColor colorWithRed:122.0/255.0 green:181.0/255.0 blue:196.0/255.0 alpha:1.0];
答案 1 :(得分:1)
使用它 你没有在每个参数后面添加.0f(float),你没有得到单元格文本颜色。
[UIColor colorWithRed:122.0f/255.0f green:181.0f/255.0f blue:196 .0f/255.0f alpha:1.0f];