iOS 程序初始一个带导航栏的视图

@synthesize window = _window;
@synthesize rootViewController = _rootViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    _rootViewController = [[ViewController alloc] init];
    
    UINavigationController *rootNaviController = [[UINavigationController alloc] initWithRootViewController:_rootViewController];

    self.window.rootViewController = rootNaviController;
    [self.window makeKeyAndVisible];

    return YES;
}

 

在上述情况下的跳转:

UINavigationController *nav = (UINavigationController*)self.window.rootViewController;
            [nav pushViewController:controller animated:YES];

 

posted on 2015-11-30 20:25  大木哥  阅读(261)  评论(0编辑  收藏  举报

导航