【发布时间】:2017-08-22 00:17:17
【问题描述】:
这是我显示和隐藏行的代码。我基本上设置了Eureka FAQ中提到的隐藏属性。请让我知道这是否是设置隐藏属性以显示/隐藏行的正确方法。
form
+++ Section("main")
<<< ButtonRow () { (row: ButtonRow) -> Void in
row.tag = "sampleRow"
if self.shouldHide {
print("hide exampleRow")
row.hidden = true
} else {
print("show exampleRow")
row.hidden = false
}
}
.cellSetup ({ [unowned self] (cell, row) in
row.title = "Title Example"
row.cell.tintColor = .red
})
.cellUpdate({ [unowned self] (cell, row) in
if self.shouldHide {
print("cellUpdate: hide exampleRow \(self.shouldHide)")
row.hidden = true
} else {
print("cellUpdate: show exampleRow \(self.shouldHide)")
row.hidden = false
}
})
.onCellSelection({ (cell, row) in
print("It's Me!")
})
稍后在代码中,我将变量 shouldHide 更新为 true 或 false 并调用 tableView.reloadData(),它确实调用了 cellUpdate 块但没有任何反应。有人可以帮忙吗?这是我的项目,您可以克隆并重现此问题。 https://github.com/cuongta/testEurekaHideShow
再次感谢!
【问题讨论】:
-
您何时需要隐藏和显示?还有一个问题是你在哪里更新尤里卡表单?
-
我需要在单击已连接到 IBAction 的按钮时隐藏和显示。这是完整的源代码:github.com/cuongta/testEurekaHideShow/blob/master/…
-
我的回答对你有帮助吗?
-
不,没有用。只有在选择单元格时,才会在oncellselection。 span>
-
检查我的更新答案
标签: ios swift swift3 eureka-forms