【问题标题】:Issue with TableviewCell in swiftswift中的TableviewCell问题
【发布时间】:2021-04-15 05:03:11
【问题描述】:

我有 2 个部分,都有 3 行。基本上我希望第 0 行第 0 行只有图像和标签组合。所有其他行将只包含文本。它在页脚上有一个注销。我该如何消除重复性,我知道这是因为我使用了 dequereuseable 单元格,但我找不到解决方法。

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    
    
        let cell = tableView.dequeueReusableCell(withIdentifier: "ImageCell", for: indexPath) as! ImageViewCell
        cell.textLabel?.font = UIFont(name: "Lato", size: 20.0)
        cell.contentView.layer.borderWidth = 0.05
        cell.layer.cornerRadius = 8
        cell.userFirstName.text = userFirstName
      
        return cell
}

【问题讨论】:

    标签: ios swift uitableview uikit


    【解决方案1】:

    您可以准备 2 个具有 2 种不同布局和不同标识符的不同单元格。然后根据indexPath.sectionindexPath.row 值将适当的出队。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-30
      • 1970-01-01
      • 2016-01-26
      • 2020-09-19
      • 1970-01-01
      相关资源
      最近更新 更多