2

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

Community
  • 1
  • 1
Christien
  • 1,213
  • 4
  • 18
  • 32

2 Answers2

2

Remove the "Scope Titles" and deselect "Shows Scope Bar" in the inspector window of the Search Bar.

enter image description here

See the TableSearch project from Apple for an example how to use a search scope to filter according to different criteria.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
  • ya right but didn't work for me...If I have deselect this then Its showing the this me when i click (on tapping the searchViewController).. and if i select this button then It would show me title on the view (means before tapping) – Christien Jan 18 '13 at 06:09
  • @Christien: As I said in my answer, you have to *remove all scope titles*, and then deselect "Shows Scope Bar". Then it works. – Martin R Jan 18 '13 at 06:18
  • ya thanks Man ! i didn't remove the all scope titles...now it works – Christien Jan 18 '13 at 06:22
  • can u help me in this answer http://stackoverflow.com/questions/14379011/xcode-4-2-not-detecting-deviceios6/14379219 – Christien Jan 18 '13 at 09:03
1

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.

iDev
  • 23,310
  • 7
  • 60
  • 85
  • didn't work with your code..that `Shows Scope Bar` from XIB I have deselected.these `Shows Scope Bar` only comes when I tap on the Searchbarcontroller...and If the select from the XIB `Shows Scope Bar` it will display in the images (means before tapping) – Christien Jan 18 '13 at 06:07
  • Try setting the scope bar titles to nil. Also do this in [searchDisplayControllerWillBeginSearch:](http://developer.apple.com/library/ios/documentation/uikit/reference/UISearchDisplayDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UISearchDisplayDelegate/searchDisplayControllerWillBeginSearch:) delegate method. – iDev Jan 18 '13 at 06:14
  • can u help me in this answer http://stackoverflow.com/questions/14379011/xcode-4-2-not-detecting-deviceios6/14379219 – Christien Jan 18 '13 at 09:03