Programmatic beginRefreshing() on iOS11 has problems with largeTitles mode

孤者浪人 提交于 2019-12-05 23:01:22

First, it is absolutely crucial that the table view extend up underneath the navigation bar and that is iOS 11 offset behavior be correct:

    self.edgesForExtendedLayout = .all
    self.tableView.contentInsetAdjustmentBehavior = .always

Second, scrolling to show the refresh control when you refresh manually is up to you, and calculating the amount is not at all simple:

    self.refreshControl!.sizeToFit()
    let top = self.tableView.adjustedContentInset.top
    let y = self.refreshControl!.frame.maxY + top
    self.tableView.setContentOffset(CGPoint(0, -y), animated:true)
    self.refreshControl!.beginRefreshing()

The bar still stays too big during the refresh, but I don't see what can be done about that. Basically Apple has implemented large titles and shown the refresh control in the nav bar without thinking through the effects or dealing with the resulting bugs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!