iOS UItableview scrollToRowAtIndexPath not working anymore

前端 未结 9 626
不知归路
不知归路 2020-12-30 01:14

This morning I just installed new Xcode which includes iOS 6.

I have a table view loaded with a plist file containing chapters and lines. Chapters define the section

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 01:44

    I'm adding this answer as an addition to Fyodor Volchyok's answer. I also found that dispatching solves the issue. I was able to find a workaround that doesn't dispatch.

    self.tableView.reloadData()
    let index = // the desired index path
    
    // For some reason, requesting the cell prior to 
    // scrolling was enough to workaround the issue.
    self.tableView.cellForRowAtIndexPath(index)
    
    self.tableView.scrollToRowAtIndexPath(index, atScrollPosition: .Top, animated: false)
    

提交回复
热议问题