User Tools

Site Tools


ios-labs-s14:basics-ib

InterfaceBuilder

The tool used to create interfaces for iOS applications.

What You See Is What You Get, drag and drop system used to put views on controllers. Stores interface information in a Storyboard file.

Storyboard- file containing the visual representation of all the scenes, transitions, and relationships in an application. Opens InterfaceBuilder when selected.

Scene- refers to a single view controller and its associated views

Segue- transition between two scenes. Right-click + drag from a button to another view controller to establish.

Root View Controller- the first controller to appear in the context of the entire application OR a UINavigationController. The first is represented by an arrow that points right with no tail on the left side. The second is an arrow between a navigation controller and another view controller, and can be set up by right-click+dragging from the navigation controller.

Connecting to Code

Each rectangle on the screen represents a View Controller and contains all the information about the views of the controller.

No explicit connection exists between the views of the controller as stored in the storyboard file and the code that makes up the class.

At runtime, the class of the controller is instantiated and paired with the views of the class as built in InterfaceBuilder. In order to realize custom behavior, change the class of objects in the storyboard by using the Identity Inspector. This ensures the class you set is paired with the view you created.

In order for controllers to call methods or change properties of views, they must have references to them. A reference is a pointer to an object. In order to connect a view to a controller, you must establish an IBOutlet or IBAction. The first of these is a variable, the second is a delegate method.

  1. IBOutlet- a variable created by right-click dragging from a view to the header file of its owner (usually a view controller). Must have assistant edit open with header file of appropriate class to connect. Can be public or private based on location inside or outside curly braces.
  2. IBAction- a method created by right-click dragging from a button to header file of owning view controller. Must be public. Creates a method declaration and definition in target controller. Method is called when button is pressed.
ios-labs-s14/basics-ib.txt · Last modified: 2014/02/17 13:42 by mbarboi