UISearchBar to be the top item in the view

So what to do if you’re building a view and you have a navigationBar at the top of the view but you want a searchbar at the top instead?
Try this in your viewDidLoad:
self.navigationController.navigationBar.topItem.titleView = searchBar;
Of course you’ll need to define searchBar in the header file too…
IBOutlet UISearchBar *searchbar;
Along with doing all the NIB file stuff, property declarations, blah blah blah… but you get the idea.


