I am trying to display a search bar that will have the same behavior as in the native maps application. I mean:
- search bar as the title bar of my navigation bar
- When selected, the search bar takes up the full width of my navigation bar and I show the SearchDisplayController
So far I have managed to get the following behavior:

As you can see above, I cannot force the search bar to occupy full width when selected. Although the full width + cancel button seems to be the default for a search bar that is connected to the SearchDisplayController, at least if the search bar has not been added to the navigation bar!
Did I miss the obvious way to do this? Or do I need to customize the navigation bar myself when searchBarShouldBeginEditing is searchBarShouldBeginEditing ?
ios iphone uinavigationbar uisearchbar uisearchdisplaycontroller
Aurelien porte
source share