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

时间:2012-02-17 21:21:47

标签: objective-c ios xcode uitableview nsindexpath

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

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

效果很好,但我想避免目标行被“选中”。见下图:

enter image description here

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

1 个答案:

答案 0 :(得分:8)

[self.listTableView scrollToRowAtIndexPath:topIndexPath
    atScrollPosition:UITableViewScrollPositionTop animated:YES];