【问题标题】:Is there a difference between using a custom UITableViewCell vs UITableViewHeaderFooterView?使用自定义 UITableViewCell 与 UITableViewHeaderFooterView 有区别吗?
【发布时间】:2021-06-17 14:58:13
【问题描述】:

我对 iOS swift 比较陌生,但是这样做有区别

class MyCustomHeaderSection: UITableViewHeaderFooterView
{
    ...
}

myTableView.register(MyCustomHeaderSection.self, forHeaderFooterViewReuseIdentifier: "section_header")

还有下面的方法

class MyCustomHeaderSection: UITableViewCell
{
    ...
}

myTableView.register(MyCustomHeaderSection.self, forCellReuseIdentifier: "section_header")

【问题讨论】:

    标签: ios swift uitableview


    【解决方案1】:

    在 UI 方面没有区别,两者都可以用作页眉/页脚,但 MyCustomHeaderSection: UITableViewHeaderFooterView 真正用于页眉/页脚,而 class MyCustomHeaderSection: UITableViewCell 用于表格的实际内容单元格

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-16
      • 2015-04-01
      • 1970-01-01
      相关资源
      最近更新 更多