Как изменить цвет шрифта в ячейке табличного представления на переменную UIColor? - PullRequest
0 голосов
/ 23 ноября 2011

Я добавляю цвет здесь, но он не отражается в ячейке.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLabel.font =[UIFont systemFontOfSize:14];
    //cell.textLabel.textColor = theFontColor;//this does not work
    //cell.textLabel.textColor = [UIColor whiteColor];//this works
    // Configure the cell.

    [self configureCell:cell atIndexPath:indexPath];

    return cell;
}

EDIT

ComfigureCell переопределял цвет. Извините, это была настоящая ошибка noob.

1 Ответ

1 голос
/ 23 ноября 2011

Вы определили где-нибудь theFontColor как UIColor

Вы должны сделать, например:

     UIColor *theFontColor = [UIColor colorWithRed:64.0f/255.0f green:58.0f/255.0f blue:43.0f/255.0f alpha:1.0f];

... и затем использовать его

...