First you need a link to your button1. Then you need to unregister the target by calling the following action:
[button1 removeTarget:self action:@selector(oldAction) forControlEvents:UIControlEventTouchUpInside]
You can pass nil as an action, this will delete all the actions related to this purpose using the button.
Then you need to call
[button1 addTarget:self action:@selector(newAction) forControlEvents: UIControlEventTouchUpInside];
That is pretty!
Hope this was helpful, Pawel
Pawel
source share