我正在使用
在一个简化的演示项目中,设置非常简单。
这在iOS 12中有效,但现在在iOS 13中(使用Xcode 11 GM编译为iOS 13),刷新动画已损坏。 迄今为止,我发现的唯一“解决方法”是将
UISearchController
进行搜索,并在支持下拉刷新的UITableViewController
中使用UIRefreshControl
。在一个简化的演示项目中,设置非常简单。
override func viewDidLoad() {
extendedLayoutIncludesOpaqueBars = true
title = searchTerm ?? "Search"
super.viewDidLoad()
setupSearch()
setupRefresh()
}
private func setupSearch() {
searchController.searchResultsUpdater = self
navigationItem.searchController = searchController
definesPresentationContext = true
//
// If this is set to `true` (which is also the default),
// UISearchBar and UIRefreshcontroll are buggy
//
navigationItem.hidesSearchBarWhenScrolling = true
}
private func setupRefresh() {
refreshControl = UIRefreshControl()
refreshControl?.addTarget(self, action: #selector(refresh), for: .valueChanged)
}
这在iOS 12中有效,但现在在iOS 13中(使用Xcode 11 GM编译为iOS 13),刷新动画已损坏。 迄今为止,我发现的唯一“解决方法”是将
navigationItem.hidesSearchBarWhenScrolling
设置为false
,但这显然会导致搜索栏始终停留在屏幕上,即使滚动也是如此。以下是演示此问题的示例项目:https://github.com/iv-mexx/UISearchControl-UIRefreshControl-iOS13-Bug/tree/feature/ios13更新:Xcode 11 GM Seed 2中仍存在此问题。