- (IBAction)onClick1:(id)sender {
// Make sure it's a UIButton
if (![sender isKindOfClass:[UIButton class]])
return;
NSString *title = [(UIButton *)sender currentTitle];
}
I understand how to get the title and other current values but I don't see how I can get the value of the tag property.
I've got a test project here where I just used:
NSInteger i = [sender tag];
You can simply call:
NSInteger the_tag = ((UIView*)sender).tag;
Each UIButton is a subclass of UIView which contains the tag
property.
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