How to define Outlets and Actions in the Classes P

2019-06-25 04:31发布

问题:

In Xcode 3 one used to be able to define Outlets, Actions etc in Interface Builder by going to the Library > Classes Pane and selecting the class from the list. Is this functionality missing in Xcode 4 ?

There is a File Template Library in the Utility area (Lower Right Corner) in Xcode 4 but my custom clases do not show here !!

回答1:

This does appear to be removed from Xcode 4, but there isn't much need for it anymore since Xcode 4 integrates the editor directly with IB. The feature never really worked that well in Xcode 3 IMO anyway.

In Xcode 4, display the header for your object by selecting your object and View>Editors>Assistant. Now control-drag from the object you want to connect into the header. This will let you automatically create an outlet or action and bind it all at once.

See the Xcode 4 Transition Guide for more information.



回答2:

agreed with Rob on that, alternative is to right click your Object in xcode's IB and this will give allow you to select actions/reference etc by means of dragging and dropping