I’m using the toolbar in my iPhone app. I have a search button on the toolbar, once you click I want to change it to done button. How do I do this?
- (IBAction) openSearch:(id) sender {
UIBarButtonItem *bbi = (UIBarButtonItem *) sender;
bool clicked = false;
if (clicked) {
// Do something
}
}
Any help?
If you would like to mimic behavior of a “done” button you could use the following code within your search method.
By toggling the BOOL “clicked” between true and false, you’ll change the style of the button between “Done” and “Bordered. You can perform whatever operations you would like within the respective conditions, and you can also customize the buttons however you want to as well. I hope this helps.
EDIT:
You could also do away with the BOOL entirely and base the condition on the existing style: