Questions tagged [uisearchbardelegate]

The UISearchBarDelegate protocol defines the optional methods you implement to make a UISearchBar control functional.

The UISearchBarDelegate protocol defines the optional methods you implement to make a UISearchBar control functional. On UISearchBarDelegate, you can find the following methods:

Editing Text

– searchBar:textDidChange:

– searchBar:shouldChangeTextInRange:replacementText:

– searchBarShouldBeginEditing:

– searchBarTextDidBeginEditing:

– searchBarShouldEndEditing:

– searchBarTextDidEndEditing:

Clicking Buttons

– searchBarBookmarkButtonClicked:

– searchBarCancelButtonClicked:

– searchBarSearchButtonClicked:

– searchBarResultsListButtonClicked:

Scope Button

– searchBar:selectedScopeButtonIndexDidChange:

150 questions
2
votes
0 answers

Searchbar disappears from tableview header after Cancel button click / tableview reloadData function

I've changed searchDisplayController with searchController for ios 8 support in my app where i use Objective-C. it works perfectly at the first try, but whenever i click on cancel button on search bar, after animation completes, my search bar…
2
votes
1 answer

How programmatically to press Cancel button of SearchBar or return it to initial state?

What I need is that after taping on Search button, the searchBar returns to its initial state, so I can get to any UI element in one tap. Because currently I need to tap anywhere on screen once before I have ability to interact with other UI…
neuro
  • 21
  • 4
2
votes
1 answer

Search Bar incorrectly overlays in multiple view controller of navigation controller

I have a Search Bar working fine created like this for my UITableView Class shown below, class customTableViewController: UITableViewController, UISearchResultsUpdating {.... override func viewDidLoad() { …
2
votes
1 answer

Customized UISearchBar

I've got an app with the following class: @interface SearchViewController : UIViewController @property (nonatomic, retain) IBOutlet UISearchBar *search; How can I customize…
Matt
  • 556
  • 1
  • 4
  • 18
2
votes
1 answer

Where does filterContentForSearchText:scope: method come from?

Recently, I noticed that filterContentForSearchText:scope: appeared in multiple tutorials regarding how to implement a search bar. However, I looked up the references of both UISearchDisplayDelegate and UISearchBarDelegate. I found this…
David Liu
  • 16,374
  • 12
  • 37
  • 38
2
votes
0 answers

UISearchbar cancel button isn't enabled when search bar isn't first responder

My UISearchbar has a visible cancel button. self.searchBar.showsCancelButton = YES; When I do [self.searchBar resignFirstResponder]; the cancel button stops working (enabled = NO) I am using this hack to forcefully enable the cancel button…
Avba
  • 14,822
  • 20
  • 92
  • 192
2
votes
3 answers

Perform action on UISearchBar when Keyboard is down and the x has been tapped

I have a UITableView with a UISearchBar on top and have a specific requirement that isn't working. I have no Cancel button on my UISearchBar (showsCancelButton = NO) so I rely completely on the x within the UISearchBar to cancel the existing…
amitsbajaj
  • 1,304
  • 1
  • 24
  • 59
2
votes
1 answer

UISearchBar delegate method calls only one time in iOS7

In iOS 7 searchbar delegate method searchBarTextDidBeginEditingis not being called on second time. When i tap first time on searchbar then it is calling searchBarTextDidBeginEditing this method but when i tap second time then it is not calling its…
Mashhadi
  • 3,004
  • 3
  • 46
  • 80
2
votes
1 answer

UISearchDisplayController delegate method is not called

I'm trying to add an UISearchBar to a table view I have defined in a ´nib´ file. I added a Search Bar and Search Display Controller in IB, linked the search bar outlet, and added this to the view controller's '.h' file: @interface…
2
votes
2 answers

filterContentForSearchText and shouldReloadTableForSearchString not called (UITableView & UISearchBar)

I'd like to implement an incremental search of words. I implemented like below, but filterContentForSearchText and shouldReloadTableForSearchString methods are not called. Why? WordsIndexViewController.h #import @interface…
2
votes
2 answers

ios - UISearchDisplayDelegate doesn't search when search text is empty

I have a table view with a search bar, I want to search when the text is empty. I want to display all the data, when the search text is empty (when the user doesn't type any search text) Note - Things work fine, when the search text is entered, the…
1
vote
2 answers

Keyboard is not responding after implementing UISearchBar delegate method

I have an UISearchBar which i implemented in my viewDidLoad: by code. I have also set the UISearchBarDelegate. Now i want to restrict the user from entering more than 5 chracter So i implement this delegate method - (BOOL)searchBar:(UISearchBar…
user930195
  • 432
  • 1
  • 5
  • 19
1
vote
1 answer

Xcode search bar not reacting to changing text or cancel being clicked

My code for search bar delegate is: extension ViewController: UISearchBarDelegate{ func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { // change the array that is being printed searching =…
Lucy Gu
  • 369
  • 1
  • 3
  • 10
1
vote
3 answers

Is it possible to have UISearchBarDelegate extension in separate file?

extension HomeViewController: UISearchBarDelegate { func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { //code } func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { //code …
faris97
  • 402
  • 4
  • 24
1
vote
2 answers

iPhone UISearchBar takes two clicks to be selected

I have a UISearchBar in my app, and I'm running the following code with it: - (void)searchBarShouldBeginEditing:(UISearchBar *)searchBar { [searchBar setShowsCancelButton:YES animated:YES]; } So when the user clicks the search bar, a cancel…
rottendevice
  • 2,849
  • 6
  • 30
  • 37
1 2
3
9 10