I’m trying to put two buttons on the screen and set them up so that the user needs to press them both at the same time in order to trigger an action.
This is similar to ctrl + alt + del on Windows or how nuclear activation sequences require two people pressing a button in different locations at the same time.
What might be the best way? Create a view that intercepts touches and then see where the touches land?
Since
UIButtonis a subclass ofUIControl, it inherits thetouchInsideproperty ofUIControl. Furthermore, whenUIButtonsends the touch-up-inside action, it still responds totouchInsidewithYES. So you can just hook both buttons up to this action:By default, Interface Builder hooks up the touch-up-inside event when you control-drag. If you would rather launch the nukes the moment the second button is simultaneously touched, hook up the touch-down events. You do this by control-clicking the buttons instead of control-dragging them.