gpt4 book ai didi

objective-c - 不使用 UITableViewController 时如何更改 clearsSelectionOnViewWillAppear?

转载 作者:IT王子 更新时间:2023-10-29 08:13:09 26 4
gpt4 key购买 nike

我有一个管理 UISearchBar 和 UITableView 的 UIViewController。我读过 Apple 不鼓励让多个 UIViewController 管理你的应用程序的一部分,所以我没有使用 UITableViewController 来管理 UITableView。相反,我在自己的 UIViewController 中实现了 UITableViewDelegateUITableViewDataSource 协议(protocol)。

我的问题是,由于我不再使用 UITableViewController,我该如何实际更改 clearsSelectionOnViewWillAppear 行为?此属性是 UITableViewController 的一部分。

最佳答案

只需调用

[myTableView deselectRowAtIndexPath:[myTableView indexPathForSelectedRow] animated:YES];

在您的 viewWillAppear: 方法中。

关于objective-c - 不使用 UITableViewController 时如何更改 clearsSelectionOnViewWillAppear?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6686203/

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