uisearchcontroller

Custom UISearchBar with UISearchController

纵然是瞬间 提交于 2019-11-27 02:49:23
问题 The documentation for UISearchController says that you can override - searchBar to provide a custom subclass of UISearchBar for the controller to use. The custom search bar does get used, and its own delegate methods are called correctly, but the UISearchResultsUpdating method no longer gets called when the search bar changes. Do I need to do a lot of wiring things up manually, or is there something I'm missing to get the controller to behave like it does with a natively supplied search bar?

UISearchController Not Redisplaying Navigation Bar on Rotate

倖福魔咒の 提交于 2019-11-27 01:40:37
问题 I have implemented the UISearchController and it is working great except... When I click on the Search Bar the Navigation Bar disappears nicely as expected. When I rotate the phone to landscape view I get this view which makes sense. However, when I rotate the phone back to portrait view (still selected in search type area) I get this following view. You can see that the Navigation Bar never reappears. I feel I'm implementing a basic search controller. What could possibly be causing this?

iOS 9 searchBar disappears from table header view when UISearchController is active

亡梦爱人 提交于 2019-11-27 00:20:25
问题 The structure: View1 (click a button) -> present modally (MyModalView: UITableViewController) MyModalView has UISearchController embedded. The searchBar of UISearchController is placed in MyModalView.tableView.tableHeaderView. It's been working fine since iOS 8.0. However on iOS 9, the searchBar disappear when the UISearchController is active. Please take a look at theses pictures below The modal view: UISearchController active on iOS 8: UISearchController active on iOS 9: The very standard

Show search bar in navigation bar without scrolling on iOS 11

淺唱寂寞╮ 提交于 2019-11-27 00:16:04
问题 I’m attaching a UISearchController to the navigationItem.searchController property of a UITableViewController on iOS 11. This works fine: I can use the nice iOS 11-style search bar. However, I’d like to make the search bar visible on launch. By default, the user has to scroll up in the table view to see the search bar. Does anyone know how is this is possible? Left: default situation after launch. Right: search bar made visible (by scrolling up). I’d like to have the search bar visible after

Hiding Cancel button on search bar in UISearchController

只愿长相守 提交于 2019-11-26 22:02:45
问题 I'm trying to hide the Cancel button of the search bar in the UISearchController, but unfortunately setting the following in viewDidLoad() does not work: override func viewDidLoad() { super.viewDidLoad() searchResultsTableController = UITableViewController() searchResultsTableController.tableView.delegate = self searchController = UISearchController(searchResultsController: searchResultsTableController) searchController.searchResultsUpdater = self searchController.searchBar.sizeToFit()

How do I use UISearchController in iOS 8 where the UISearchBar is in my navigation bar and has scope buttons?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 19:59:45
问题 I'm trying to use the new UISearchController from iOS 8, and embed its UISearchBar in my UINavigationBar . That's easily done as follows: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater = self searchController.delegate = self searchController.searchBar.delegate = self searchController.dimsBackgroundDuringPresentation = false searchController.hidesNavigationBarDuringPresentation = false navigationItem.titleView = searchController

Attempting to load the view of a view controller while it is deallocating… UISearchController

筅森魡賤 提交于 2019-11-26 12:56:49
问题 I have code that creates a UISearchController\' in my UIVIew\'s viewDidLoad`. self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self controller.searchBar.delegate = self controller.dimsBackgroundDuringPresentation = false controller.searchBar.sizeToFit() controller.hidesNavigationBarDuringPresentation = false //prevent search bar from moving controller.searchBar.placeholder = \"Search for song\" self

UISearchBar presented by UISearchController in table header view animates too far when active

孤人 提交于 2019-11-26 09:24:51
问题 I am using UISearchController to present a search bar inside the header view of a tableview: ... self.searchController.hidesNavigationBarDuringPresentation = NO; self.presentingTVC.tableView.tableHeaderView = self.searchController.searchBar; [self.searchController.searchBar sizeToFit]; self.presentingTVC.tableView.tableHeaderView = self.searchController.searchBar; (where setting the tableHeaderView property twice is necessary as otherwise the header view overlaps the first row, c.f.a couple