简体   繁体   中英

Is there a difference between using a custom UITableViewCell vs UITableViewHeaderFooterView?

I'm relatively new to iOS swift, but is there a difference between doing this

class MyCustomHeaderSection: UITableViewHeaderFooterView
{
    ...
}

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

And the following approach

class MyCustomHeaderSection: UITableViewCell
{
    ...
}

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM