Try this,
for (NSString *buttonTitle in buttons) {
UIButton *bottomOptionButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
....
bottomOptionButton.tag = index;
....
[self.optionsKeyboard addSubview:bottomOptionButton];
....
}
And in optionBottomButtonPressed:
- (void)optionBottomButtonPressed:(id)sender
{
NSLog(@"tu tag :: %d", button.tag);
NSLog(@"de opcion :: %@", [self.bottomButtonArray objectAtIndex:button.tag] );
UIColor *selectedButtonColor = [[ThemeManager shared]buttonSelectedBackground];
UIColor *nonSelectedButtonColor = [UIColor whiteColor];
for (int i = 0; i<= self.bottomButtonArray.count; i++) {
UIButton *button = (UIButton *)[self.optionsKeyboard viewWithTag:i];
button.backgroundColor = nonSelectedButtonColor;
}
[sender setBackgroundColor:[UIColor redColor]];
}