티스토리 뷰

방법은 간단하다.

NavigationController에 ViewController를 넣어주면 되는데.

이것을 다시 TabBarController에 넣어주면 된다.

말이 어렵지 그냥 코드를 보면 이해를 할 것이다.


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    

    FirstViewController* contorller1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];

    contorller1.title = @"Tab1";

    UINavigationController* controller1_nav = [[UINavigationController alloc] initWithRootViewController:contorller1];

    

    SecondViewController* controller2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];

    controller2.title = @"Tab2";

    

    self.tabBarController = [[UITabBarController alloc] init];

    self.tabBarController.viewControllers = [NSArray arrayWithObjects:controller1_nav, controller2, nil];

    

    self.window.rootViewController = self.tabBarController;

    

    [self.window makeKeyAndVisible];

    

    return YES;

}


실행하여 보면, 첫번째 Tab에만 네비게이션이 들어가 있는것을 확인할 수 있을것이다.

끝.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함