How to stop UITableView from returning to top cell after popover

后端 未结 4 1333
春和景丽
春和景丽 2021-01-24 13:47

I have a tableView full of images. When a user taps on an image (within the cell), a viewController with a larger zoomable version of the image is called with a popover segue. W

4条回答
  •  一整个雨季
    2021-01-24 14:17

    Get tableview content offset before displaying your zoomViewController.

    -(void)viewWillDisappear:(BOOL)animated {
    
      [super viewWillDisappear:animated];
    
      tableViewContentOffset = self.tableView.contentOffset;
    
    }
    

    and set tableview offset again in viewWillAppear

    -(void)viewWillAppear:(BOOL)animated {
    
       [super viewWillAppear:animated];
    
       [self.tableView setContentOffset:tableViewContentOffset];
     }
    

提交回复
热议问题