xcode selectRowAtIndexPath: 动画:scrollPosition: - 行被“选中”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9335589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
selectRowAtIndexPath: animated: scrollPosition: - Row is "selected"
提问by Solid I
I am using the following code to scroll to the top of a tableView:
我正在使用以下代码滚动到 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:
它工作得很好,但我想避免“选择”目标行。见下图:
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?
关于如何在此代码运行后“取消选择”行的任何想法?或者更好的是,以不首先“选择”目标行的方式运行此代码?
回答by rob mayoff
[self.listTableView scrollToRowAtIndexPath:topIndexPath
atScrollPosition:UITableViewScrollPositionTop animated:YES];