iosios4uisearchbaruisearchbardelegate

How to hide/disable UISearchBars Scopebar


I am using a sample code from apple developer site as a base : http://developer.apple.com/library/ios/#samplecode/TableSearch/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007848-Intro-DontLinkElementID_2 Its a simple table Search code. What I am trying to do is populate a table with my own data with different cell styles and searching the contents using the search bar. Now I was successfully able to complete all what I wanted to accomplish here but I want to hide the scopebar which appears when user clicks on search bar. I tried setting scopeButtonTitles = nil using method found here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UISearchBar_Class/Reference/Reference.html

But still the scope bar shows up. If you run the table search bar you can see the scopebar with titles as 'All,device,desktop,portable', I tried searching for an array containig these values but never found one. So can anyone please tell me how to hide the scope bar. What methods should I implement and where should I implement?


Solution

  • Use the showsScopeBar property. Set it to NO.

    EDIT

    For UISearchBars handled by UISearchDisplayController, you will have to the make that array nil.

    self.searchDisplayController.searchBar.scopeButtonTitles = nil;