User Tools

Site Tools


objective-c:examples:navigationcontroller

Differences

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

Link to this comparison view

objective-c:examples:navigationcontroller [2012/12/20 12:24] (current)
Line 1: Line 1:
 +====== NavigationController ======
 +Add a UIViewController named RootViewController to your empty project
 +
 +
 +===== Create a NavigationController for your project =====
 +
 +First step import the RootViewController.h in your AppDelegate
 +<code objc>
 +#import "RootViewController.h"
 +</code>
 +
 +Second step initialize NavigationController with RootViewController and add it to window
 +<code objc>
 +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 +{   
 +    // ** initialize window **
 +    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 +    // Override point for customization after application launch.
 +    
 +    // ** initialize RootViewController **
 +    RootViewController *rootVC = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
 +    
 +    // ** Initalize NavigationController with RootViewController **
 +    UINavigationController *navVC = [[UINavigationController alloc]initWithRootViewController:rootVC];
 +
 +    // ** Add NavigationController **
 +    self.window.rootViewController = navVC;
 +    
 +    self.window.backgroundColor = [UIColor whiteColor];
 +    [self.window makeKeyAndVisible];
 +    return YES;
 +}
 +</code>
  
advertising
objective-c/examples/navigationcontroller.txt · Last modified: 2012/12/20 12:24 (external edit)

Impressum Datenschutz