swift - 使用搜索栏和大标题导航栏拉动刷新问题

标签 swift uitableview uinavigationbar uisearchbar pull-to-refresh

在导航 Controller 中使用大标题导航栏和搜索栏时出现问题,当我尝试拉动以刷新 tableview 时显示结束刷新时出现突然行为。

var searchController : UISearchController!
self.searchController = UISearchController(searchResultsController: nil)

        self.tableView.refreshControl = self.refreshControl

        self.navigationItem.searchController = searchController
        self.navigationItem.hidesSearchBarWhenScrolling = false

        self.definesPresentationContext = true
        self.searchController.obscuresBackgroundDuringPresentation = false

        self.searchController.delegate = self
        self.searchController.searchBar.delegate = self
        self.searchController.searchResultsUpdater = self

结束刷新

enter image description here

最佳答案

我有同样的问题,我设法让它工作的唯一方法是手动设置 tableView 的 contentOffset。

tableView.refreshControl?.endRefreshing()
tableView.setContentOffset(CGPoint(x: 0, y: 0), animated: true)

关于swift - 使用搜索栏和大标题导航栏拉动刷新问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50812404/

相关文章:

ios - 照片库权限 - 为什么我的应用程序没有显示在“设置”应用程序中? (iOS 12.1 Xcode 10.1)

xcode - 没有名为 dequeueReusableCellWithIdentifier 的成员

ios - 用 Facebook 好友填充 UITableView

ios - 从数据库中删除记录

ios - 快速更改导航栏颜色时出现覆盖

ios - 如何根据 uitableview 行选择更改导航栏标题?

ios - 切换屏幕/ View Controller

ios - 设置标签集合的字体

ios - 管理音频实例以允许交叉淡入淡出等的最佳策略

ios - 在 iOS 11 上从右到左显示大标题