Swift中静态TableView中特定单元格的披露指示器 [英] Disclosure indicator to specific cell in static TableView in Swift
本文介绍了Swift中静态TableView中特定单元格的披露指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个静态TableView,并且我想添加还是删除一个披露指标,具体取决于我们是在咨询自己的帐户还是访客帐户.
I created a static TableView and I would like to add or remove a disclosure indicator depending if we are consulting our own account or a guest account.
这就是我想要的:
let index = IndexPath(row: 4, section: 0)
let cell = tableView.cellForRow(at: index)
if currentUser {
cell.accessoryType = .none
//cell.backgroundColor = UIColor.red
}
我试图将其放在viewDidLoad函数中,但是它不起作用.我也尝试了cellForRowAt indexPath和相同的结果.
I tried to put it in the viewDidLoad function but it didn't work. I tried cellForRowAt indexPath also and same result.
我该怎么办?
推荐答案
您正在使用静态单元格,因此不会调用cellForRow
.相反,只需拖动连接您的单元并进行设置,就像这样
Your are working with static cells so cellForRow
will not get called. Instead, simply drag connect your cell and set it up, like this
这篇关于Swift中静态TableView中特定单元格的披露指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文