I am trying to emulate the search bar in the Calendar app and finding it surprisingly difficult although many people have posed this question on SO and elsewhere and many half answers have been offered. (I need to support IOS 7).
The main requirements are
1) There is a search bar button.
2) When above button is pressed, a search bar with cancel appears in the navigation bar.
To accomplish 1) you just put a bar button item on the navigation bar. No problem.
To accomplish 2) is the hard part.
To get the search bar to display in the navigation bar as opposed to elsewhere you are supposed to just set
self.searchDisplayController.displaysSearchBarInNavigationBar= true
as here;
I can get the search bar to appear in the nav bar but without a cancel button.
The code to show a cancel button is supposed to be:
self.searchDisplayController.searchBar.showsCancelButton = YES;
This is not working in conjunction with placing the search bar in the nav bar.
Finally, as opposed to searchDisplayController, something called a search bar has a property called .hidden. After dragging a search bar and search displaycontroller to the view, I've created an outlet property for this and tried to change this without success. (Changing it from true to false has no apparent effect on the output.)
Is there anyone out there who has successfully created this UX who can describe all the steps needed to emulate the search bar in the calendar app in IOS 7.0?