2

Pretty basic - I have multiple buttons and I just need to tell which button was pressed most recently, despite how many times on each or how long between clicks.

koz
  • 195
  • 1
  • 13
  • 1
    Assign a different tag to each button, and then in your button handler routines update a property called `lastButtonTag` with the tag of the button. – vacawama Dec 22 '16 at 22:41

1 Answers1

1
  • Give each button a unique tag in Interface Builder.
  • Make a variable that holds the tag of the last button that has been clicked.
  • In event handlers of your buttons set the variable from the step above to the tag of the button currently being clicked.
  • When you need to find the last button that has been clicked, check the variable, it will have the unique tag of your button.
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523