gpt4 book ai didi

ios - 为什么 tableViewCell 在返回到 ViewController 时未被选中?

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

我的 ViewController 中有一个带有自定义单元格的 tableView,我选择一个单元格并转到下一个 ViewController。

然而,返回时,单元格会自动取消选择。

这是我第一次看到这样的东西。

我没有在里面写任何东西,viewDidAppear、viewWillAppear、viewDidDisappear 或第一个 ViewController 的 viewWillDisappear 可以做这样的事情。

我在模拟器中以缓慢的动画运行代码以查看发生了什么。

返回时,单元格仍处于选中状态,但很快选中状态就消失了。

我在 customCell 的 setSelected:animated: 方法中放置了一个断点,以回溯调用它的内容。

这是我看到的...

enter image description here

最佳答案

这是UITableViewController的属性,设置clearsSelectionOnViewWillAppear为NO

关于ios - 为什么 tableViewCell 在返回到 ViewController 时未被选中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17529672/

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