selectRowAtIndexPath:animated:scrollPosition:-行被“选择”

发布于 2025-01-06 08:02:01 字数 411 浏览 3 评论 0原文

我使用以下代码滚动到 tableView 的顶部:

NSIndexPath *topIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.listTableView selectRowAtIndexPath:topIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];

它效果很好,但我想避免“选择”目标行。请参见下图:

在此处输入图像描述

有关如何在此代码运行后“取消选择”行的任何想法?或者更好的是,以一种不首先“选择”目标行的方式运行此代码?

I am using the following code to scroll to the top of a tableView:

NSIndexPath *topIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.listTableView selectRowAtIndexPath:topIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];

It works great, but I'd like to avoid the target row from being "selected". See image below:

enter image description here

Any ideas on how to "deselect" the row after this code runs? Or better yet, run this code in a way that doesn't "select" the target row in the first place?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

意中人 2025-01-13 08:02:01
[self.listTableView scrollToRowAtIndexPath:topIndexPath
    atScrollPosition:UITableViewScrollPositionTop animated:YES];
[self.listTableView scrollToRowAtIndexPath:topIndexPath
    atScrollPosition:UITableViewScrollPositionTop animated:YES];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文