Questions tagged [uisearchcontroller]

The UISearchController class defines an interface that manages the presentation of a search bar. It has attached a search results controller’s content that manages the results of the search.

The UISearchController class defines an interface that manages the presentation of a search bar. It has attached a search results controller’s content that manages the results of the search.

1268 questions
87
votes
6 answers

Show search bar in navigation bar without scrolling on iOS 11

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…
Jonathan
  • 6,572
  • 1
  • 30
  • 46
82
votes
13 answers

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

I have code that creates a UISearchController' in my UIVIew'sviewDidLoad`. self.resultSearchController = ({ let controller = UISearchController(searchResultsController: nil) controller.searchResultsUpdater = self …
MortalMan
  • 2,582
  • 3
  • 23
  • 47
75
votes
5 answers

How do you dismiss a UISearchController ? (iOS 8 and follow)

This must be trivial, but I can't find how you're supposed to dismiss a UISearchController programmatically? Note that it's the new UISearchController (introduced in 2014 with iOS 8), not the UISearchDisplayController. So far here's what I've got //…
Arnaud
  • 17,268
  • 9
  • 65
  • 83
61
votes
3 answers

Installed App from TestFlight crashes due to alleged UISearchDisplayController

I implemented Dark Mode with the current beta version of Xcode in a relatively old app. I uploaded these to TestFlight for my testers. However, this crashes immediately for anyone who has the public beta of iOS 13. I've integrated Crashlytics into…
59
votes
9 answers

UISearchController iOS 11 Customization

I had been using the following code prior to iOS 11 to customize the appearance of the UISearchController search bar: var searchController = UISearchController(searchResultsController:…
Alexander MacLeod
  • 2,026
  • 3
  • 14
  • 22
58
votes
15 answers

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

I am using UISearchController to present a search bar inside the header view of a tableview: ... self.searchController.hidesNavigationBarDuringPresentation = NO; self.presentingTVC.tableView.tableHeaderView =…
Zoë Smith
  • 1,084
  • 1
  • 11
  • 19
58
votes
22 answers

Cannot set searchBar as firstResponder

I have a searchBar I'm setting in a tableviewcontroller. i've referenced this similar question UISearchBar cannot become first responder after UITableView did re-appear but am still unable to set it as first responder. In .h file: @property…
55
votes
13 answers

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

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…
David Trang
  • 1,434
  • 1
  • 10
  • 10
48
votes
3 answers

How to implement UISearchController in UITableView - Swift

I am a newbie to Swift and I am trying to add search functionality to my UITableView which is in a UIViewController class. I googled a lot and found that UISearchDisplayController has been deprecated and replaced by UISearchController. When I tried…
user4790024
45
votes
14 answers

Change UISearchBar cancel button text in iOS 8

I'd like to change the text from "Cancel" to "Done" of the Cancel button inside the UISearchBar in iOS 8. I am using UISearchController. I've tried different approaches for iOS 6 and iOS 7 and they do not work. Has anybody done this?
Wilmer
  • 753
  • 1
  • 5
  • 9
39
votes
15 answers

UISearchController: show results even when search bar is empty

As I understand, the default behaviour of UISearchController is: On tapping search bar, background is dimmed and 'cancel' button is shown. SearchResultsController is not shown till this point. SearchResultsController is displayed only if search bar…
optimus
  • 876
  • 1
  • 9
  • 19
38
votes
4 answers

iOS 13 UIBarButtonItem not clickable and overlapping UINavigationBars when using UISearchController

I got a navigation bar containing some UIBarButtonItem buttons and a UISearchBar hooked up like this var searchController: UISearchController! override func viewDidLoad() { super.viewDidLoad() title = "Test" tableView.delegate = self …
heyfrank
  • 5,291
  • 3
  • 32
  • 46
32
votes
10 answers

When assigning focus via becomeFirstResponder to UISearchController's UISearchBar, the keyboard does not appear

I've spent quite a bit of time searching online and talking to other developers about this issue to no avail. The exact issue is described in this SO post (Focus on the UISearchBar but the keyboard not appear), although it's many years old. I…
chris P
  • 6,359
  • 11
  • 40
  • 84
31
votes
8 answers

UISearchController searchBar in tableHeaderView animating out of the screen

I have a UISearchController with a UITableViewController as a searchResultsController, the UISearchBar of this searchController is set to be in the tableHeaderView of my current tableView displayed in my root ViewController. Almost everything is…
30
votes
2 answers

UISearchController persisting after segue

I have an app with a UISearchController. This element of the UI is completely set up in code like this: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater =…
Kilian
  • 2,122
  • 2
  • 24
  • 42
1
2 3
84 85