I have an NSMutableArray instance, named myArray. It contains 8 button objects. How can I get the index of the button which I have taped to a integer variable?
NSArray has a method called indexOfObject
- (IBAction)pushButton:(id)sender {
NSButton *button = (NSButton *)sender;
NSUInteger index = [Array indexOfObject:button];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With