问题
In my program, I want the users could touch a picture so that an action will be activated. However, the function IBAction cannot allow me to connect it with the picture. Is there any method that can help me to trigger a function when the users touch the picture? Thank you!
回答1:
You can activate the User Interaction for that picture, and then detect taps on it and trigger the action based on them. But the simplest solution would be to just put a button behind it, and connect the IBAction to that button. That's what we do in such cases.
来源:https://stackoverflow.com/questions/8643115/how-can-i-make-an-action-for-a-picture