Hi, I think, I need another good advice. Up to now my solution seemed to run well, but now...
OK, the facts:
- I have an ordinary UIViewController
- On top a UINavigationBar, behind that a UISearchBar, hidden initially
- At bottom a UIToolBar
- My main view controller supports UISearchBarDelegate
A switch on UIToolBar toggles the visibility of the UISearchBar
if (show) {
[searchBar setShowsCancelButton:TRUE animated:TRUE];
[navigationBar setHidden:TRUE];
[searchBar becomeFirstResponder];
}
else {
[navigationBar setHidden:FALSE];
[searchBar setShowsCancelButton:FALSE animated:TRUE];
}
searchIsVisible = !searchIsVisible;
There is some animation around, but I have dropped this for example. It works well, I can enter a search string and access it using "searchBarSearchButtonClicked:". I'm also able to react on "searchBarCancelButtonClicked:"
I either didn't notice it before or it happens right now - I'm occasionally catching an EXC BAD ACCESS without further notice. I'm pretty sure, the "[searchBar becomeFirstResponder];" statement is the reason for that, because I can provoke it with tapping into the search line too.
Unfortunately I'm unable to figure out, what the reason is. Do I have to provide another delegate method, as the two I have right now?
Any pointer welcome. Regards