Im making an app with 4 UIImageView and 4 UIButtons. Each button are connected to a UIAlerView which has an option that opens the photolibrary so the UIImageView can be changed.
My problem is that I dont know how to tell the UIAlertView which UIButton was pressed.
How can I write that which button was pressed?
You can connect all buttons to another method if you are using interface builder or add them different targets. It will be easier but not very scalable, or it won’t be compatible with a dynamic number of buttons.
Add the same target & selector to all buttons using:
and inside aButton tapped method check which button is tapped and act accordingly:
Using interface builder will be easier in both cases.