2

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Aniket
  • 131
  • 1
  • 3
  • 9

1 Answers1

5

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;
Deepak Danduprolu
  • 44,595
  • 12
  • 101
  • 105
  • I tried this and set self.showsScopeBar = NO; in viewdidLoad but still I am getting the scope bar! Am I setting it in wrong place? – Aniket May 23 '11 at 20:45
  • Edited with relevance to the sample project above. The last statement should do the job for you. – Deepak Danduprolu May 23 '11 at 20:54
  • It worked! but then I lost the search functionality? What is exactly happening? I tried removing 'self.showScopeBar = NO' still there is no search functionality. But the scope bar is now hidden. – Aniket May 23 '11 at 21:06
  • Update: there was a code using the contents of scope for searching the table contents. I modified the function accordingly and it worked like a charm! thanks! – Aniket May 23 '11 at 21:48
  • Thanks! Was really struggeling with this, trying to set showsScopeBar = NO. This did the trick! – Jensen2k Mar 08 '12 at 12:20