How to programmatically have UITableView scroll to a specific section

前端 未结 6 1438
离开以前
离开以前 2021-02-13 20:40

In my calendar app, I want my UITableView to scroll to a specific section based on which date is tapped. Current implementation is below:

- (void)calendarDidDate         


        
6条回答
  •  终归单人心
    2021-02-13 21:07

    Swift 3.0

    DispatchQueue.main.async {
       let indexPath = IndexPath(item: 'item', section: 'section')
       self.tableView.scrollToRow(at: indexPath, at: .top, animated: true)
    }
    

提交回复
热议问题