Try the UIGestureRecognizer
class.
This implementation will allow you to recognize different predefined user interactions.
UITapGestureRecognizer
is the subclass that you need.
In your controller you can do the following:
// Do this in your viewDidLoad
// Instance variable
recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap)];
[recognizer setMinimumNumberOfTouches:2];
[recognizer setMaximumNumberOfTouches:2];
And add a method for the buttons:
- (void) doubleTap {
//Hide/unhide buttons
}
For the buttons should first add them as outlets (instance variables with the keyword IBOutlet) and you should add them to your view.
Make sure to link them up. See here.
When you link them up, you could use the following statement to hide/unhide them.
First option:
buttonOne.hidden = !buttonOne.hidden
buttonTwo.hidden = !buttonTwo.hidden
Second option:
//Add a instance variable hideButtons of type BOOL. I prefer this, your always sure the hidden value for each button has the same value.
hideButtons = !hideButtons
buttonOne.hidden = hideButtons
buttonTwo.hidden = hideButtons
In your viewDidLoad you should explicitly set hideButtons to your initial value. Although it is not required when the boolean value is false, but i always do it for clarity.
Hope this was helpful.