Зачем вам нужно использовать tag
, чтобы получить кнопку.Вы можете напрямую получить ссылку на кнопку из метода действия.
- (void)onButtonPressed:(UIButton *)button {
// "button" is the button which is pressed
NSLog(@"Pressed Button: %@", button);
// You can still get the tag
int tag = button.tag;
}
Я надеюсь, что вы добавили target-action для кнопки.
[button addTarget:self action:@selector(onButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];