Get UIButton Text from sender
Asked Answered
M

1

11

How can i obtain the text of a UIButton in my

-(IBAction)clicked:(id)sender

method?

Thanks

Monarchy answered 2/7, 2010 at 23:57 Comment(0)
B
43

What about this:

- (IBAction)clicked:(id)sender {
  UIButton *button = (UIButton *)sender; 
  NSString *buttonTitle = button.currentTitle;
}
Boorish answered 3/7, 2010 at 12:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.