selectRowAtIndexPath: animated: scrollPosition: - Row is "selected"

Solid I picture Solid I · Feb 17, 2012 · Viewed 8k times · Source

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?

Answer

rob mayoff picture rob mayoff · Feb 17, 2012
[self.listTableView scrollToRowAtIndexPath:topIndexPath
    atScrollPosition:UITableViewScrollPositionTop animated:YES];