From 36a87394790787bed0735b9955d2b0ad1677bf5a Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 18 Dec 2017 22:22:03 -0600 Subject: [PATCH] Fixes GamesDatabaseBrowserViewController iOS 11 issues --- .../GamesDatabaseBrowserViewController.swift | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Delta/Database/OpenVGDB/GamesDatabaseBrowserViewController.swift b/Delta/Database/OpenVGDB/GamesDatabaseBrowserViewController.swift index f4a0fe6..132c586 100644 --- a/Delta/Database/OpenVGDB/GamesDatabaseBrowserViewController.swift +++ b/Delta/Database/OpenVGDB/GamesDatabaseBrowserViewController.swift @@ -62,7 +62,16 @@ class GamesDatabaseBrowserViewController: UITableViewController self.dataSource.searchController.delegate = self self.dataSource.searchController.searchBar.barStyle = .blackTranslucent - self.tableView.tableHeaderView = self.dataSource.searchController.searchBar + + if #available(iOS 11, *) + { + self.navigationItem.searchController = self.dataSource.searchController + self.navigationItem.hidesSearchBarWhenScrolling = false + } + else + { + self.tableView.tableHeaderView = self.dataSource.searchController.searchBar + } self.updatePlaceholderView() } @@ -195,8 +204,12 @@ extension GamesDatabaseBrowserViewController: UISearchControllerDelegate { func didPresentSearchController(_ searchController: UISearchController) { - // Fix incorrect table view scroll indicator insets - self.tableView.scrollIndicatorInsets.top = self.navigationController!.navigationBar.bounds.height + UIApplication.shared.statusBarFrame.height + if #available(iOS 11, *) {} + else + { + // Fix incorrect table view scroll indicator insets + self.tableView.scrollIndicatorInsets.top = self.navigationController!.navigationBar.bounds.height + UIApplication.shared.statusBarFrame.height + } } func willDismissSearchController(_ searchController: UISearchController)