首页 > 解决方案 > 我想用tableview设计三层。谁能解释

问题描述

我想用tableview设计三层。谁能解释

if indexPath.section == 0 {
    if indexPath.row == 0 {
        let cell = tableView.dequeueReusableCell(withIdentifier: "HederCell") as? HederCell
        cell?.textLabel?.text = getData?.mainservice_name
        return cell!
    }

我试图使这种类型无法正常工作,
请检查下图以更好地理解我的问题。

样本

标签: iosiphone

解决方案


如果您想在表格视图单元格之前添加一些文本,请使用此重写方法并使用 UIview 相应地设计您的单元格。

 func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

}

推荐阅读