2012-02-17 35 views
2

我使用下面的代碼滾動到的tableView的頂部:selectRowAtIndexPath:動畫:的scrollPosition: - 行被「選中」

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

它的偉大工程,但我想,以避免目標從「被選中」排。見下圖:

enter image description here

如何運行此代碼後,「取消」行任何想法?或者更好的是,以一種不「選擇」目標行的方式運行此代碼?

回答

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

啊,是的,這是很有道理的,讓我測試。 – 2012-02-17 21:30:25

+0

精美的作品,謝謝Rob – 2012-02-17 21:32:25

相關問題