You do not need to explicitly set the tag. You can define the IBOutlets UIButton in your .h file and their properties, as well as
@property (nonatomic , retain) IBOutlet UIButton *myButton;
and method how
-(IBAction) browse : (id) sender;
in the .m file you can implement the method as
-(IBAction) browse : (id) sender{
if((UIButton *)sender == myButton){}
}
Add as many buttons to the if statement as you want. Connect the IBOutlets of all the relevant buttons, and also select the selector.
Remember to free IBOutlets in the dealloc method to prevent memory leaks.
Hope this helps!
source
share