Q:

How to find the index of an array?

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?

A:

NSArray has a method called indexOfObject
- (IBAction)pushButton:(id)sender {
    NSButton *button = (NSButton *)sender;
  NSUInteger index =  [Array indexOfObject:button];

}

