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

前端 未结 9 1054
逝去的感伤
逝去的感伤 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:53

    You need to set the cell type to Subtitle when you allocate it.

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

提交回复
热议问题