Xcode 4 IBOutlet

Written by t3rman on March 2, 2011 in Objective-C, Xcode - No comments

To generate an IBOutlet is fairly simple in Xcode 4 in comparison to Xcode 3. Open the xib up and make sure that you are in assistant editor mode with the relative h file open next to it. Then simply ctrl click the UIButton component and drag it across to the h file and release. Once released a popup will show asking you which identifier you would like to use. Xcode then writes the necessary code in the h file leaving you to enter the functionality in the m file. Example below:
Example h file

Example m file

Leave a Comment