In Keynote (and other apps), I’ve noticed the “standard” interface of doing Undo/Redo is by providing an Undo button on the tool bar.
Clicking the button (that is always enabled) Undos the recent operation.
(If there is not recent operation to undo, it will show the Undo/Redo menu).
Long-clicking the Undo button opens an Undo/Redo menu.
I searched for methods of implementing this, and the best answer I found so far is at the following link.
I wonder if anyone knows of a simpler way?
Thanks!
After reviewing all methods and discussing with friends, below is the solution I used, for a UIBarButtonItem the responds to both taps and long-press (TapOrLongPressBarButtonItem).
It is based on the following principals:
… So far – this approach was in the other SO thread – and I didn’t like this approach since I couldn’t find and easy enough way of making the custom view appear like an iPad navigation bar button… Soooo…
Use UIGlossyButton by Water Lou (thanks water!). This use is encapsulated within the subclass…
The resulting code is as follows:
And all you need to do is:
1. Instantiate is as follows:
2. Connect the button to the navigation bar:
3. Implement the TapOrPressButtonDelegate protocol, and you’re done…
Hope this helps anyone else…