gpt4 book ai didi

ios - 选择单个 tableView 行

转载 作者:行者123 更新时间:2023-11-28 21:10:03 25 4
gpt4 key购买 nike

我正在尝试在我的 tableView 上选择一个预定义的单元格。在 viewDidLoad() 上,我添加了这段代码

tableView.selectRow(at: selectionIndexPath, animated: true, scrollPosition: .none)

此剂量仅在我将 self.tableView.allowsMultipleSelection 设置为 true 时有效。否则该单元格未被选中。你对这个问题有想法吗?我也做了 self.tableView.allowsSelection = true 但仍然有问题。

最佳答案

将您的代码移至 viewDidAppear:

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
tableView.selectRow(at: selectionIndexPath, animated: true, scrollPosition: .none)
}

关于ios - 选择单个 tableView 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43894008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com