In cases where multiple buttons call an IBOutlet, can the IBOutlet determine which button was pressed?
edit:
All fixed and wired up. key point: Object ID is not sender tag! Tag is a standalone value on the first page of the attributes.
- (IBAction)buttonPressed:(id)sender { switch ( [sender tag] ) { case 109: NSLog(@'Button 1'); break; case 108: NSLog(@'Button 2'); break; } }
Normally you would connect the buttons event (Touch Down) to the IBAction method you wish to invoke in your controller.
The method prototype would look like:
Then the ‘sender’ could be used to verify identity of the object doing the calling if needed.
IBOutlet would be used to contact the UIButton from your code, to set its text or properties for example.