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

前端 未结 13 1920
一个人的身影
一个人的身影 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:59

    For those still finding solution to this, you can use the following extension of UITableView.

    Including a check where first section has row(s) or not. It goes till the section with row(s) comes and then scrolls to that one.

    extension UITableView {
    
        func scrollToFirst() {
    
            self.reloadData() // if you don't want to reload data, remove this one.
            for i in 0..

    Hope that helped you.

提交回复
热议问题