Use the [sender tag] .
Why not sender.tag , you ask?
You can only use dot notation if you attach sender to an instance of UIView , as in ((UIView *)sender).tag . UIView objects have a tag property. If you do not use sender as an instance of UIView , this only matches the id that conforms to the NSURLAuthenticationChallengeSender protocol and it lacks the tag property.
Here is an example of using a button tag:
#define kButtonTag 2 - (void)viewDidLoad {
source share