This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ios-labs-s14:basics-ib [2014/02/16 20:45] mbarboi |
ios-labs-s14:basics-ib [2014/02/17 13:42] (current) mbarboi |
||
---|---|---|---|
Line 2: | Line 2: | ||
The tool used to create interfaces for iOS applications. | 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. | What You See Is What You Get, drag and drop system used to put views on controllers. Stores interface information in a **Storyboard** file. | ||
- | A storyboard is the visual representation of all the scenes, transitions, and relationships in an application. | + | **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. | ||
- | A scene refers to a single view controller: it is a | + | ===Connecting to Code=== |
+ | Each rectangle on the screen represents a **View Controller** and contains all the information about the views of the controller. | ||
- | A segue manages the transition between two scenes. A segue is established by pressing ctrl key and dragging from one scene to the other. Pushing a view controller to the navigation stack and presenting a modal view controller on the click of a button can be done easily with the help of segue thereby reducing the need for coding. | + | No explicit connection exists between the views of the controller as stored in the storyboard file and the code that makes up the class. |
- | The entire application flow can be seen in the storyboard file. | + | 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. |
- | View Controllers- every long rectangle on the screen represents a ViewController. These rectangles are the only things that can “float” in IB's main window | + | 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. |
- | Arrows- arrows in IB represent relationships between ViewControllers. | + | -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. |
+ | -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. |