1

I have to change the words Search and Cancel from the SearchBar(and the keyboard) when I'm using the search controller.

I have already changed the placeholder like this

searchController.searchBar.placeholder = "My text here..."

But I can't find anything useful for Swift considering the searchBar is constructed programmatically.

searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar

Can anyone help?

UPDATE: so far I managed to change the Cancel button text like this:

searchController.searchBar.setValue("Anuleaza", forKey:"_cancelButtonText")

But could not find a way to change the keyboard word for Search with a custom text.

asheyla
  • 3,175
  • 5
  • 18
  • 34
  • http://stackoverflow.com/questions/2705865/change-uisearchbar-keyboard-search-button-title ? You can't really put a custom text on KeyBoard, you have to use on of the available return type... – Larme Oct 21 '16 at 12:21
  • @Larme, you are right, add what you said as an answer, not a comment and I will accept it. – asheyla Nov 09 '16 at 10:39
  • I marked the question as a duplicate instead of copying on the answers on the link. – Larme Nov 09 '16 at 10:40

0 Answers0