Ios 隐藏行的多个单元格高度索引路径静态表视图swift
我想将多个静态tableview单元格的高度更改为零并恢复正常Ios 隐藏行的多个单元格高度索引路径静态表视图swift,ios,uitableview,swift,heightforrowatindexpath,Ios,Uitableview,Swift,Heightforrowatindexpath,我想将多个静态tableview单元格的高度更改为零并恢复正常 override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { if reminderHidden && indexPath.section == 1 && indexPath.row == 1 { return 0
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if reminderHidden && indexPath.section == 1 && indexPath.row == 1 {
return 0
}
else {
return super.tableView(tableView, heightForRowAtIndexPath: indexPath)
}
}
我可以更新bool值&上面的方法可以很好地隐藏一个静态单元格。但它在返回一个值后停止。我想隐藏两个静态单元格,并在更改一个布尔值时使它们恢复正常。您需要做的是在该函数中返回0.1。0是默认值(44px)。 然而,你会发现在做这件事的时候有很多小问题。例如:
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if indexPath.row == 1 && toggle.on == false {
return 0.0
}
if indexPath.row == 2 {
if toggle.on == false || pickerVisible == false {
return 0.0
}
return 165.0
}
return 44.0
}
有关更多详细信息,请访问我的博客:
我最初的问题是将两个单元格一起隐藏&将两个单元格一起取消隐藏。我接下来的问题是如何分别隐藏两个单元格。在不干扰第一个单元格的隐藏/显示设置的情况下,我想隐藏或显示第二个单元格,反之亦然。请在此处添加您博客中的解释,否则,如果链接无效,您的答案将不会保留任何有价值的信息。你可以在你的答案中添加关键点,同时留下扩展信息的链接。这对我不起作用。对于静态单元格,忽略heightForRow atIndexPath。