tableViewUi 单元格字幕有时显示

tableViewUi cell subtitle shows sometime

我在使用 UITableViewCell 时遇到问题。 table 视图加载时,某些单元格没有字幕。我已经将单元格的样式设置为字幕。 奇怪的是,当我上下滚动时,丢失的部分再次出现,但其他一些单元格缺少 table 副标题。 这是我的 cellForRowAtIndexPath

代码
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! UITableViewCell
    cell.layoutMargins = UIEdgeInsetsZero
    cell.preservesSuperviewLayoutMargins = false
    let poList = self.PoList[indexPath.row]
    if(poList.POShort == "header"){
        cell.backgroundColor = SharedClass().coopGroupHeaderColor
        let selectedColor = UIView()
        selectedColor.backgroundColor = SharedClass().coopGroupHeaderColor
        cell.selectedBackgroundView = selectedColor
        cell.textLabel?.textColor = UIColor.blackColor()
        cell.textLabel?.font = UIFont.boldSystemFontOfSize(18.0)
        cell.textLabel?.textAlignment = .Left
        cell.accessoryType = .None
        let t_header = "Program Office"
        cell.textLabel?.text = t_header
        cell.detailTextLabel?.text = ""
        cell.userInteractionEnabled = false;
    }
    else{
        cell.backgroundColor = indexPath.row % 2 == 0 ? UIColor.clearColor() : SharedClass().cellBackGroundColor
        let selectedColor = UIView()
        selectedColor.backgroundColor = SharedClass().selectedCellColor
        cell.selectedBackgroundView = selectedColor
        cell.textLabel?.font = UIFont.boldSystemFontOfSize(11.0)
        cell.textLabel?.textColor = UIColor.blackColor()
        if(poList.POShort != "OTHER" && poList.POShort != "invalid" && poList.POShort != "all"){
            cell.textLabel?.text = poList.POName + " - " + poList.POShort
        }
        else{
            cell.textLabel?.text = poList.POName
        }
        let cellValue = "Total number of staff not responded - " + poList.totalUsers
        cell.detailTextLabel?.text = cellValue
        if(poList.totalUsers == "0"){
            cell.userInteractionEnabled = false;
            cell.accessoryType = .None
        }
        else{
            cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
        }
    }


    return cell

因此,这个缺少字幕的单元格也不会执行 push segue。

请帮忙。

谢谢。

可能是问题所在 - 您没有在以下 if 语句中设置任何值:

if(poList.POShort == "header"){
     ......
    .......
    cell.detailTextLabel?.text = ""   <<<<<<<<
    ......