0

I've implemented the searchBarSearchButtonClicked delegate method in my view controller

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {

    searchBar.text = textView.text
}

The method is successfully called when the "Search" button is clicked but the searchBar.text property is empty.

Any ideas why searchBar.text would be empty?

Rui Peres
  • 25,741
  • 9
  • 87
  • 137
am17
  • 3
  • 1
  • 2

1 Answers1

1

You should use the value from "searchBar.text" instead of assigning the value of the "textView.text" to it. Try this:

Comment this "searchBar.text = textView.text" and add "NSLog(@"%@",searchBar.text);"

Check in your log the value of the search bar now. You could also check your XIB file, if you have connected your search bar's delegate to your File's owner.

Rui Peres
  • 25,741
  • 9
  • 87
  • 137