0

I'm relatively new to iOS programming and I have a Table View Controller that has a Navigation bar at the top and i'm trying to get the search bar from "search bar and search display controller" to appear in the navigation bar.

I've googled around and i've found that:

self.searchDisplayController.displaysSearchBarInNavigationBar = YES;

is supposed to solve my problem but i'm not sure exactly where I would put it. Does it go in the table view controller or do I have to make another control? I've tried creating a UISearchDisplayController class but I couldn't find a way to link it to the search bar. Any help?

karthika
  • 4,085
  • 3
  • 21
  • 23
user1217222
  • 67
  • 2
  • 8
  • http://stackoverflow.com/questions/19226922/uitextfield-within-uisearchbar-failing-after-ios-7-upgrade/19227102#19227102 – Rajneesh071 Oct 18 '13 at 09:41

1 Answers1

1

You can put this in the viewDidLoad of your view controller. If you are using story boards you create a UISearchDisplayController and Search bar and drag it into your table header.

Keep in mind that if you use the navigation bar for your search bar, it will not show the scope bar.

Ray Fix
  • 5,575
  • 3
  • 28
  • 30
  • Sorry for the delayed response, just found some time to work on this again. I've tried adding a UITableView to my storyboard and adding the associated classes for it. I then add the SearchBar and Search Display Controller to the heading of it and then adding "self.searchDisplayController.displaysSearchBarInNavigationBar = YES;" to the viewDidLoad for the UITableViewController. The issue is that nothing appears, just the table. No navigation bar or search bar – user1217222 Oct 26 '13 at 01:04