Interface Builder

You are using the Single View App template because it is the simplest template that Xcode offers. Still, this template has a significant amount of magic in that some critical components have already been set up for you. For now, you will just use these components, without attempting to gain a deep understanding of how they work. The rest of the book will be concerned with those details.

In the project navigator, click once on the Main.storyboard file. Xcode will open its graphical editor called Interface Builder (be patient; it may take a few moments). You might be asked to give permission to SimulatorTrampoline, one of Xcode’s internal tools. If you are, grant it.

Interface Builder divides the editor area into two sections: the document outline, on the lefthand side, and the canvas, on the right.

This is shown in Figure 1.8. If what you see in your editor area does not match the figure, you may have to click the Show Document Outline button. (If you have additional areas showing, do not worry about them.) You may also have to click the disclosure triangles in the document outline to reveal content.

Figure 1.8  Interface Builder showing Main.storyboard

Interface Builder showing Main.storyboard

The rectangle that you see in the Interface Builder canvas is called a scene and represents the only “screen,” or view, your application has at this time. (Remember that you used the Single View App template to create this project.)

In the next section, you will learn how to create a UI for your application using Interface Builder. Interface Builder lets you drag objects from a library onto the canvas to create instances and also lets you establish connections between those objects and your code. These connections can result in code being called by a user interaction.

A crucial feature of Interface Builder is that it is not a graphical representation of code contained in other files. Interface Builder is an object editor that can create instances of objects and manipulate their properties. When you are done editing an interface, it does not generate code that corresponds to the work you have done. A .storyboard file is an archive of object instances to be loaded into memory when necessary.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.22.136