This is what I have in my navigationItem: back button, UISearchBar (as the titleView) which is a part of my subclassed searchDisplayController, and map button in the rightBarItem slot.
WHAT WORKS:
When a user clicks into the UISearchBar, the back button and mapbutton animate away, the searchBar fills up the gap left by the back button disappearing, and the cancel button appears. This is working fine.
I've done this with the searchBarTextDidBeginEditing method:
WHAT DOESN'T:
However, I can't get the reverse animation just right, when the user leaves the searchBar. I'm allocating a new UIBarButtonItem and putting it into the navigationItem.rightBarButtonItem, and I'm setting self.navigationItem.hidesBackButton = NO in the searchBarTextDidEndEditing delegate method. What happens is that the buttons appear very sudden, the searchBar expands to the full width of the screen (which I want to prevent from happening), and then shrinks again to where it ought to be.
Does anybody have any suggestions to get the animations to behave well?
Darthtroll
WHAT WORKS:
When a user clicks into the UISearchBar, the back button and mapbutton animate away, the searchBar fills up the gap left by the back button disappearing, and the cancel button appears. This is working fine.
I've done this with the searchBarTextDidBeginEditing method:
Code:
self.navigationItem.hidesBackButton = YES;
self.navigationItem.rightBarButtonItem = nil;
WHAT DOESN'T:
However, I can't get the reverse animation just right, when the user leaves the searchBar. I'm allocating a new UIBarButtonItem and putting it into the navigationItem.rightBarButtonItem, and I'm setting self.navigationItem.hidesBackButton = NO in the searchBarTextDidEndEditing delegate method. What happens is that the buttons appear very sudden, the searchBar expands to the full width of the screen (which I want to prevent from happening), and then shrinks again to where it ought to be.
Does anybody have any suggestions to get the animations to behave well?
Darthtroll