Search code examples
iphoneiosuisearchbaruisearchdisplaycontroller

Remove Title button of UISearchBarDisplayController


In have embedded a UISearchBarDisplayController with UITableView that works fine but problem is that when I click on UISearchBarDisplayController to search it gives me two Title buttons you can see below in image.. How do i Remove these two buttons ..these are of no use...

and is it possible to give some search methods in these buttons.like to search initials and last ...if not then how can i remove this ..I Have tried all the XIB methods but didn't work for me...

first


Solution

  • Try this,

    searchBarDisplayController.searchBar.showsScopeBar = NO;
    searchBarDisplayController.searchBar.scopeButtonTitles = nil;
    

    That is a scope bar shown in image. You can set these properties in xib as well.

    Based on your comment, put the above code in searchDisplayControllerWillBeginSearch: delegate method. That should work.