iOS UItableview scrollToRowAtIndexPath not working anymore

前端 未结 9 630
不知归路
不知归路 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 02:02

    Fyodor Volchyok's answer in Swift:

    tableView.reloadData()
    let indexPath = NSIndexPath(forRow: linePos, inSection: chapterPos)
    // make sure the scroll is done after data reload was finished
    dispatch_async(dispatch_get_main_queue()) {
       self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: true)
    }
    

提交回复
热议问题