How to get a UITableview to go to the top of page on reload?

前端 未结 13 2131
一个人的身影
一个人的身影 2021-02-01 02:30

I am trying to get a UITableview to go to the top of the page when I reload the table data when I call the following from

- (void)pickerView:(UIPickerView *)pic         


        
13条回答
  •  误落风尘
    2021-02-01 02:44

    Perfectly to the top of page on reload, by twice reloading

    dataForSource = nil
    tableView.reloadData()
    
    DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
        self.dataForSource = realData
        self.tableView.reloadData()
    }
    

提交回复
热议问题