【发布时间】:2020-07-16 05:41:53
【问题描述】:
我的应用程序中有表格视图,单击此列表中的任何项目后,我将移至此功能中的详细信息视图:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.tabBarController?.tabBar.isHidden = true
let storyboard = UIStoryboard(name: "Fruitslist", bundle: nil)
guard let details = storyboard.instantiateViewController(identifier: "DetailView") as? DetailView else { return }
details.modalPresentationStyle = .fullScreen
details.delegate = self
self.show(details, sender: nil)
}
在此详细视图中,我有协议:
protocol AddToNotepad {
func addToNotepadFunc(added:Bool)
}
当我从这个详细信息屏幕移动到主列表时,我会发送一些数据:
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if self.isMovingFromParent {
self.tabBarController?.tabBar.isHidden = false
self.delegate?.addToNotepadFunc(added: true)
}
}
在我的主列表中,我在扩展中收到此数据:
extension FruitList:AddToNotepad{
func addToNotepadFunc(added: Bool) {
let indexPath = IndexPath(item: 1, section: 2)
if let fruitCell = tableView.cellForRow(at: indexPath) as? FruitListCell {
fruitCell.eTitle.text = "232332322332"
}
}
}
而且我不明白如何在某些部分更新单元格的某些部分。我也可以发送详细视图的部分,但是如何在我不明白的部分更新单元格的某些元素:(你可以看到我的尝试,但它不起作用。也许有人知道我在哪里犯了一些错误?
【问题讨论】:
-
@Frankenstein,因为这是我造成的愚蠢错误:) 我认为这个问题对这个技能数据库没有帮助,但是如果你认为这个问题会,我当然可以恢复它有用
标签: ios swift uitableview uikit