Now you get to add your nib file. You’ll be using the interface builder that doesn’t generate source code. You can, however, manipulate objects and then save them in the nib file. But first you have to create the nib file by going to developer/applications to launch the Interface Builder. You then need to select “Cocoa Touch” in the templates selection window and then select to view the template. You then choose File > new.
Next, you’ll see three objects and will choose “view.” But before you edit the view, you will need to save the file in your project director. “ControllerView” is a good file name. It must match the name you created when you had to create a file at the initWithNibName: bundle phase. When Interface Builder asks you if you want to save it, you do. Make sure you still have Xcode running. You also want to confirm the file is listed in the project files listing.
Configuring the file’s owner
You have to configure the file’s owner next and you do this by selecting the “File’s Owner” icon in the Interface Builder and then choose tools> identity inspector. The identity inspector will then show.
In the class field of the class identity section, enter MyViewController.
Connecting the view outlet
The only connection left is the view outlet. When you are in the Interface Builder, you need to drag the “File’s Owner” file to “view.” The Interface Builder will now show that there is only one outlet available. Click on “view” The view icon’s quick flash means that the nib file is loaded. You can now save the file. Click the Build and Go icon in the toolbar so that you can compile and run the application. Compilation should be error free and a white screen present in the simulator.
The view controller will load the nib file automatically.
Adding user interface elements
Now you will go to the Interface Builder and choose tools > Library to display the library window. You can then drag view items from the library and drop them onto the view. You can then resize and reposition. You can also add a text field, button, or label by typing UI and what you want (example: UITextField). You can customize your entire screen.
When you are in the view section during your changes, you want to choose “Clear Context” before drawing each element so that the previous string is removed before creating a new one. When you are finished, save your file.
Make connections
You make connections by dragging and dropping. You can do such things as connect the Lable and TextField. When you do such things as resize, you can see what outlets are available to you.
Once you have made connections and made changes that you need to make to your application, you can then test the application by building and running it. You should find that everything is working properly within the application. If you do find any errors, you can go back and make changes to get rid of those errors.