When you tap on a UIBarButtonItem
in a UIToolbar
, there is a white glow effect.
Is there a possibility to fire an event to show this effect?
I don't want to press the button. Only the effect should be displayed. I want to visualize to the user, that there is new content behind this button.
Thanks for your help!
Heres the "highlight.png", I'm not kidding! (Though you may not seeing it on a white background.)
You can try to recreate a new bar button item with different style, and then reassign it back. My experiment was:
In viewDidLoad:
And in method highlight:
Your implementation might be different than mine, but as long as you are fine with reassigning the bar button, I think it'll work as expected. Good luck :)
If you have a category:
Then you need code like this…
…to highlight the button in the navigation bar after 2 seconds.
For Bar items
In General - Assuming you have a button
you can at any given point, programmatically call this function:
or if you like to have an highlight image
A very simple alternative:
That said , you can also set the button like this:
The following method assumes you are using the toolbarItems property of a navigation controller and that the button you want to highlight is the last item in that array. You can apply it to any toolbar, of course, and pick a different array index if necessary.
Right now this is not exactly perfect, because the animation moves the new button from the lower left of the screen. However, I think that can be turned off with a little effort.
Note that I used PeakJi's image.
I hope this works for you.
Enjoy,
Damien
A simple ay is to init your UIBarButtonItem with a CustomView (UIBUtton)