iPhone App Development Tutorial Part 3
CONNECT ACTIONS AND OUTLETS
There has to be a way to transfer data and instruction between objects. This is done by connecting the actions and the outlets for the actions to the MainWindow. Since we created two objects on our main window, we need to make two connections; one for each object.
- Click on the View and then click on the “Connections” tab of the Inspector Window so that you can begin to connect your objects. You will now use the dot next to the object to connect it to its target. Notice the “dots” in the illustrations below next to the label and the rounded rect button object. (Ex: You would connect a button outlet to a button object.)
- Drag the “mainText” Outlet from the Connections tab on the Inspector Window to the Label object on your .xib.
- Drag the “showText” Action to the Button on your .xib & select “touchup inside.”

GENERATE THE CODE
Now that we have created the visual portion of our application, we are making our code match this visual setup. We are going to write the “class” files . . . the .h and .m.
- Select the mainView by clicking on it once.
- From the Interface Builder menu, select File => Write Class Files and “Save as” whatever filename you want. In this case save it as “background.” (By default it will save the filename as whatever you named the class.
- Make sure the box next to “Create .h file” is checked.
- Also check the option box that allows you to save files to the project
- Now select “File => Save” from the Interface Builder Menu to save the entire project. This will now create two new files in Xcode called “background.h” and “background.m.”
- Now go to Xcode and drag the two new files (”background.h” and “background.m”) into the “Classes” folder of the XCode project.

Use the links below to access the remainder of the tutorial.
- iPhone App Development Tutorial – Part 1
- iPhone App Development Tutorial – Part 2
- iPhone App Development Tutorial – Part 3
- iPhone App Development Tutorial – Part 4


