User Tools

Site Tools


ios-labs-s14:basics-navs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ios-labs-s14:basics-navs [2014/02/13 19:29]
mbarboi created
ios-labs-s14:basics-navs [2014/02/16 21:11] (current)
mbarboi
Line 1: Line 1:
-UINavigationController are used when you want to have some sort of hierarchal representation of your data (ie drill down). They work using a stack of UIViewController subclasses. Every time you “drill down”, you simply add another view controller to the stack. Then, the “back” logic is simply a matter of popping view controllers off of a stack.+=====Navigation Controllers=====
  
-At the bottom ​of the stack, ​there is the rootViewController which get set during initialization and can never be popped offAt the top of the stack, ​is the current ​view controller ​who’s view is being displayed ​to the user.+Used to maintain a **stack** ​of controllers in an application. Provides structure and a simple way of navigating between controllers.  
 + 
 +Created by dragging a Navigation Controller onto a **StoryBoard** and setting ​the root view controller by right-click + dragging. 
 + 
 +Adds a **Nav Bar** to each view controller in its stack, ​giving it space to have a title, used to identify controllers. Autogenerates a back button in the top left corner when on a controller that is not the **root view controller**,​ allowing a user to **pop** a controller, returning to the previous controller 
 + 
 +**Root View Controller**- the first controller to appear when a navigation controller becomes active. Navigation controllers must always have root view controller.  
 + 
 +Presenting a new view controller is acheived by **pushing** a controller onto the navigation controller (aka nav stack). Removing a controller by **popping**. 
 + 
 +**pushing**- adds a view controller to the top of the stack, ​making it active and giving it the screen. Previous top view controller is now covered and sits in the second ​to last position.  
 + 
 +**popping**- removes ​the topmost view controller from the stack, exposing the one beneath it, giving it the screen again.
ios-labs-s14/basics-navs.1392341385.txt.gz · Last modified: 2014/02/13 19:29 by mbarboi