In UITableView, cell.detailTextLabel.text isn't working… why?

前端 未结 9 1020
逝去的感伤
逝去的感伤 2020-12-08 00:34

In tableView:cellForRowAtIndexPath: I have the following:

cell.textLabel.text = @\"label\";
cell.detailTextLabel.text = @\"detail\";


        
相关标签:
9条回答
  • 2020-12-08 00:58
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier: CellIdentifier];
    
    0 讨论(0)
  • 2020-12-08 01:00

    Make sure to set the default text content, and the width is width is wide enough to actually display the text.

    0 讨论(0)
  • 2020-12-08 01:07

    Set the table View Cell Style to Subtitle in Storyboard

    and write this code to configure you cell

    if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:BasicCellIdentifier] autorelease];
    }
    

    enter image description here

    0 讨论(0)
提交回复
热议问题