Ios 如何查找TableView节头索引路径?
我想根据TableView节头索引路径执行某种操作。 是否有任何方法可以跟踪节头索引路径?如何 简短回答 目前还没有这种方法 解决方案 在自定义标头类中声明节号变量Ios 如何查找TableView节头索引路径?,ios,swift,uitableview,Ios,Swift,Uitableview,我想根据TableView节头索引路径执行某种操作。 是否有任何方法可以跟踪节头索引路径?如何 简短回答 目前还没有这种方法 解决方案 在自定义标头类中声明节号变量 class CustomHeader: UITableViewHeaderFooterView { // // MARK :- PROPERTIES // var sectionNumber: Int! // // MARK :- METHODS // override func awakeFromNib() { s
class CustomHeader: UITableViewHeaderFooterView
{
//
// MARK :- PROPERTIES
//
var sectionNumber: Int!
//
// MARK :- METHODS
//
override func awakeFromNib()
{
super.awakeFromNib()
// Initialization code ...
}
func configureWith(_ section: Int)
{
self.sectionNumber = section
}
} // end of class
然后在viewForHeaderInSection
内的视图控制器中,在实例化自定义标题时指定节值
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
{
let header = tableView.dequeueReusableHeaderFooterView(withIdentifier: "selectHeaderIdentifier") as! CustomHeader
header.configureWith(section)
return header
}
现在,您的自定义标题中有一个节号属性,可以随意使用:]
header.sectionNumber
你到底是什么意思?节的标题没有行,但只有对节的引用。我们是否可以像检测行的indexpath一样检测其indexpath?@sandesh找到方法了吗?
header.sectionNumber