Interface Builder workflow

You use Interface Builder, the visual design editor that’s integrated into Xcode, to lay out your app’s user interface and make connections to your code.

Step 1: Open a user interface file

Select a user interface file in the Project navigator, and the file opens in Interface Builder in the editor area. The first time you open a user interface file, a sheet appears asking you to choose a device family from a pop-up menu. Pick the device you expect most people will use.

The views appear in the canvas area and the structure of the underlying objects appear in the outline view. If you create your project from a template, the Main.storyboard file contains default view controllers and views that will appear when your app first launches.

To hide or show the outline view, choose Editor > Hide Document Outline or Editor > Show Document Outline. Or click the Show Document Outline button () at the lower-left corner of the canvas.

Step 2: Add controls, graphics, icons, audio, and other UI objects

In the utilities area, drag objects from the Object library () or media files from the Media library () to the canvas where you lay out your user interface.

Step 3: Connect views and controls to your code

As you add object to the user interface, you can write the code that implements their behavior in the assistant editor. Use Interface Builder to visually connect the user interface objects to your code.

Step 6: View the UI using different device configurations and create variations as needed

Start by viewing the user interface using different device configurations that you expect most users running your app will have. Then create variations of the user interface as needed.

Step 4: Define layout constraints for your app’s user interface

When an object in your user interface changes its size or position, layout constraints cause that object and its neighboring objects to adjust their sizes and positions automatically. Layout constraints are represented by blue lines on the canvas.

Step 5: Design the user interface of your app with storyboards

Graphically lay out the user’s path through your app in a storyboard consisting of scenes, segues that connect the scenes, and controls to trigger the segues.

Step 7: Preview your layout

Preview your app’s user interface layout before building and running your app. You can preview different device families and localizations too.

SEE ALSOAdd objects to the user interfaceAdd an outlet connection to send a message to a UI objectAdd an action connection to receive messages from a UI objectView the user interface using different device configurationsAbout Auto Layout and Layout ConstraintsAbout storyboards, scenes, and connectionsPreview your layout for different iOS devices in different orientations and localizations