User Tools

Site Tools



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

Link to this comparison view

Both sides previous revision Previous revision
ios-labs-s14:basics-navs [2014/02/13 19:30]
ios-labs-s14:basics-navs [2014/02/16 21:11] (current)
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 off. At 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
-UINavigationController manages views by arranging them inside ​stackThe top most view in the stack is the one which is visible. The RootViewwhich is the first view in the stack does not have back button whereas all the other views either have back button or the title of the previous ​view in the stack in the place of the back button.+Created ​by dragging ​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 ​controller by **popping**. 
 +**pushing**- adds 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.txt · Last modified: 2014/02/16 21:11 by mbarboi