【发布时间】:2017-03-21 03:35:09
【问题描述】:
我需要为我的表格视图制作一个自定义标题。为此,我创建了一个 UITableViewHeaderFooterView 类型的类,但是我无法在情节提要上选择 tableview 的标题来设置该类。如果它是静态表头,则会出现,但对动态表不可见。如何进行此设置?
注意:我使用的是 xcode 7.3.1
我正在尝试做这样的事情,但情节提要: https://github.com/jeantimex/ios-swift-collapsible-table-section
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = tableView.dequeueReusableHeaderFooterViewWithIdentifier("header") as! NovaListaTableViewHeader
header.titleLabel.text = sections[section].name
header.arrowLabel.text = ">"
header.setCollapsed(sections[section].collapsed)
header.section = section
header.delegate = self
return header
}
【问题讨论】:
-
分享您的代码并分享您在 Stackoverflow 上阅读的类似问题。否则你的问题很快就会被标记。 :|
标签: ios swift uitableview