User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







objective-c:examples:navigationcontroller

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

#import "RootViewController.h"

Second step initialize NavigationController with RootViewController and add it to window

- (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;
}

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
objective-c/examples/navigationcontroller.txt · Last modified: 2024/02/16 01:06 (external edit)

Impressum Datenschutz