Субтитры ячейки таблицы не отображаются - PullRequest
0 голосов
/ 21 февраля 2012

Я установил стиль ячейки для подсвечивания в инспекторе, но субтитры по-прежнему отсутствуют, просто пусто, но отображается заголовок вот раздел в контроллере вида:

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

UITableViewCell *cell = nil;

cell = [tableView dequeueReusableCellWithIdentifier:@"homeworkcell"];

if(cell == nil)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:@"homeworkcell"];

}
cell.textLabel.text = [tabledata objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [tablesubtitles objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:14.0];

 //static NSString *CellIdentifier = @"Cell";

  /* if (cell == nil) {
    cell = [[UITableViewCell alloc]
            initWithStyle:UITableViewCellStyleSubtitle
            reuseIdentifier:CellIdentifier];
  }*/

 // Configure the cell.
 //-----------------------------------------START----------------------------Set image of  cell----
  cellImage = [UIImage imageNamed:@"checkboxblank.png"];

 cell.imageView.image = cellImage;

 //--------------------------------------------END---------------------------end set image of cell--  

 return cell;

}

1 Ответ

5 голосов
/ 21 февраля 2012

Вам нужно использовать UITableViewCellStyleSubtitle при создании нового UITableViewCell, а не UITableViewCellStyleDefault. UITableViewCellStyleDefault показывает только textLabel в ячейке, а не detailTextLabel.

См. Раздел «Стили ячеек» справки UITableViewCell и «Стандартные стили для ячеек табличного представления» руководства по программированию Табличное представление .

...