取消选择 UITableViewCell 时没有动画
我正在使用 Loren Brichter 的 FastScrolling UITableView 子类 在我的 iOS 应用程序中,当表视图被推回到堆栈顶部时,我在正确取消选择表视图中的单元格时遇到问题。我的 viewWillAppear 方法如下所示:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:YES];
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
单元格被取消选择,但没有任何动画。我该如何解决这个问题?
更新
如果我删除上面的代码,则会发生完全相同的事情。是否每次将视图推入堆栈顶部时,表视图的新实例都会添加到旧实例之上?
I'm using Loren Brichter's FastScrolling UITableView subclass in my iOS app, and I have a problem properly deselecting the cells in the table view, when it's pushed back on top of the stack. My viewWillAppear
method looks like this:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:YES];
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
}
The cell is deselected, but without any animation. How can I fix this?
Update
If I remove the code above, the exact same thing happens. Could it be that a new instance of the table view is added on top of the old every time the view is pushed on top of the stack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您的单元格可能在取消选择调用之前被取消选择,并且您在 viewWillAppear 方法中取消选择。所以此时视图是不可见的。
尝试在
viewDidAppear
中使用您的代码。because your cell is probably deselected before your deselect-call and you are deselecting in the
viewWillAppear
-method. So at this moment the view is not visible.try to use your code in
viewDidAppear
.