问题
I am new to Interface Builder. I have a method (IBAction) defined in my class. I want to fire this method when a particular button is clicked.
I cant see any way to add an action via the IBBuilder
回答1:
Setting up an Action
- Right-Click on your control instance
- Drag to your target and let go.
Setting up an Outlet
- Right-Click on your object instance
- Drag to your control instance and let go.
Inspecting Actions/Outlets/Bindings
- Right-Click on your object instance
回答2:
Have you defined your method as an IBAction? You need to do like this for the method appear in the "File Owner's".
来源:https://stackoverflow.com/questions/6319212/how-do-i-attach-an-action-to-a-button-using-interface-builder