即使在 tableView 重新加载数据后,UITableView 选择也会突出显示
我上面有一个 UIScrollView 和一个 UITableView 。 UITableView 有 4 个单元格。我使用 UIPageControl 进行分页。
当用户选择时,单元格会突出显示,当用户滚动到下一页时,单元格会保持突出显示。
我尝试了 [tableView reloadData] ,在调用后我仍然可以看到 UITableView 上选定的行,但我不明白。
我应该重画 UIScrollView 吗?
有什么办法可以清除选择吗?
I have a UIScrollView and a UITableView on it. The UITableView has 4 cells. I use UIPageControl for pagination.
When user selects, the cell gets highlighted and when the user scrolls to the next page the cell stays highlighted.
I tried [tableView reloadData] and after the call I could still see the selected row on the UITableView which I do not understand.
Should I redraw the UIScrollView?
Is there any way of clearing up the selection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您将表视图包含在另一个视图中时,我已经看到了这种行为。如果这样做,您需要手动清除当前选择。您可以通过调用以下命令来完成此操作:
其中“动画”设置以满足您的需要。
如果您直接包含表格视图(正如另一个人指出的那样,您的表格视图本身已经滚动得很好,可能会使您的 UIScrollView 变得不必要并且启动时形式不好),这种行为是自动的。
I've seen this behavior when you include a table view within another view. If you do this, you need to manually clear up the current selection. You can do this by calling the following:
where 'animated' is set to fit your needs.
If you include the table view directly (as another person noted, you a table view already scrolls just fine all by itself, likely making your UIScrollView unnecessary and bad form to boot), this behavior is automatic.
您是否使用 UIScrollView 和/或 UIPageControl 来滚动 UITableView? UITableView 不需要其中任何一个来滚动。
从你的描述来看,听起来你没有正确地重复使用细胞。
放置一些代码,我们将有更多的工作要做。您可能需要向我们展示您的 UITableView 子类 .m 文件。
Are you using a UIScrollView and/or UIPageControl to scroll the UITableView? UITableView doesn't need either of those for scrolling.
From your description, it sounds like you are not reusing cells properly.
Put up some code and we'll have more to work with. You might have to show us your UITableView subclass .m file.