IPhone Development: The Best Way to Let the User Select the Search Scope
I'm developing my first iPhone app and want the user to be able to select a search scope in a more complex way than the "scope button" resolution.
The app is related to wines and I want the user to be able to first select a "color" (red, white, blush, etc.) and then select a type / variety in that category. Right now, I'm using the UISearchBar scope buttons for colors, and clicking the button opens the color picker view. This is fine, except that after the Red button has been selected, I cannot select it a second time to change my type selection (for example, change from Merlot to Sirra, etc.) ). If thereβs a better way to do it, Iβm willing to drop my method and start from scratch.
Thanks!
a source to share
Why can't you click it a second time?
It will just use a standard visibility bar with one button to choose from (color, type, etc.). When the button is clicked, output the UIPickerView with possible values. When a value is selected, display it in the button.
If there are only two options, you can also present one UIPickerView with two segments.
a source to share
Sometimes it takes a question for the answer to come to you. I put the following line in the "viewDidDisappear" delegate method:
[self.searchDisplayController.searchBar setSelectedScopeButtonIndex: -1];
This is done in order to set the currently active sphere button to "nothing" so that none of the scope buttons are selected when returning to the original view. Thus, you can choose any of them, including the one you last selected. This is exactly what I wanted to do.
I don't know if this is "best practice" but it will serve.
a source to share