I think the title is pretty self explanitory. I have a tableView embedded in a navigation controller and want to add a search bar to the navigation bar. I think something changed in iOS 9 regarding searchbar controller things so keep in mind this has to be for iOS 9. This is what i have. No doubt it is wrong.
UISearchController *searchController = [[UISearchController alloc]init];
self.searchController.searchBar.barTintColor = [UIColor whiteColor];
[self.navigationController addChildViewController:searchController];
// For ios8/ios9 use the following code
If you are using a UISearchDisplayController, this should work.
Apple Docs
Add it via storyboard. Add the search bar in the view controller scene like exit and first responder are added and after that just give the titleView of navigation item to the search bar.