Fixes GamesDatabaseBrowserViewController iOS 11 issues

This commit is contained in:
Riley Testut 2017-12-18 22:22:03 -06:00
parent c0ffa10fff
commit 36a8739479

View File

@ -62,7 +62,16 @@ class GamesDatabaseBrowserViewController: UITableViewController
self.dataSource.searchController.delegate = self self.dataSource.searchController.delegate = self
self.dataSource.searchController.searchBar.barStyle = .blackTranslucent self.dataSource.searchController.searchBar.barStyle = .blackTranslucent
if #available(iOS 11, *)
{
self.navigationItem.searchController = self.dataSource.searchController
self.navigationItem.hidesSearchBarWhenScrolling = false
}
else
{
self.tableView.tableHeaderView = self.dataSource.searchController.searchBar self.tableView.tableHeaderView = self.dataSource.searchController.searchBar
}
self.updatePlaceholderView() self.updatePlaceholderView()
} }
@ -194,10 +203,14 @@ extension GamesDatabaseBrowserViewController
extension GamesDatabaseBrowserViewController: UISearchControllerDelegate extension GamesDatabaseBrowserViewController: UISearchControllerDelegate
{ {
func didPresentSearchController(_ searchController: UISearchController) func didPresentSearchController(_ searchController: UISearchController)
{
if #available(iOS 11, *) {}
else
{ {
// Fix incorrect table view scroll indicator insets // Fix incorrect table view scroll indicator insets
self.tableView.scrollIndicatorInsets.top = self.navigationController!.navigationBar.bounds.height + UIApplication.shared.statusBarFrame.height self.tableView.scrollIndicatorInsets.top = self.navigationController!.navigationBar.bounds.height + UIApplication.shared.statusBarFrame.height
} }
}
func willDismissSearchController(_ searchController: UISearchController) func willDismissSearchController(_ searchController: UISearchController)
{ {