Programmatically force a UIScrollView to stop scrolling, for sharing a table view with multiple data sources

前端 未结 10 965
醉话见心
醉话见心 2020-12-08 03:04

I have a UITableView whose data source and delegate are switched between a couple of custom data source objects when the user touches a segmented control (think \"Top Paid\"

10条回答
  •  [愿得一人]
    2020-12-08 03:36

    Did you try these 2 methods?

    They actually apply to the "scrolling" not just the offset of the content.

    [self.tableView  scrollToRowAtIndexPath:savedIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
    

    OR:

    [self.tableView  scrollRectToVisible:savedFrame animated:NO];
    

    They should actually effect the scrolling and by extension the acceleration of the table, not just what is visible on screen.

提交回复
热议问题