-4

A is a subclass of TabbarViewController

A *a = [[A alloc] init];

B *b = [[B alloc] init];
C *C = [[C alloc] init];

NSArray *viewControllers = [NSArray arrayWithObjects:b,c, nil];
[a setViewControllers:viewControllers];

UINavigationController *nv =[[UINavigationController alloc] initWithRootViewController:a];
nv.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:nv animated:YES completion:nil];

And in A.m: I find the a.navigationController.navigationBar is nil I dont know why?

jxdwinter
  • 2,339
  • 6
  • 36
  • 56
  • 1
    Are you trying to put TabBarController inside a NavigationController? Please, write your actual classes instead of A, B, C. – Stas Aug 06 '13 at 04:03
  • @Stas Yes, A is a subclass of TabbarViewController and I want to put A into a navigationController. – jxdwinter Aug 06 '13 at 05:03

1 Answers1

0

Normally, you should create several NavigationController objects for each of TabBarController's tabs.

When you create a navigation interface, you need to decide how you intend to use a navigation interface. Because it imposes an overarching organization on your data, you should only use it in these specific ways:

Install it directly as a window’s root view controller.

Install it as the view controller of a tab in a tab bar interface.

Install it as one of the two root view controllers in a split view interface. (iPad only)

Present it modally from another view controller.

Display it from a popover. (iPad only)

If you still want 'TabBarController inside NavigationController' functionality, please, read this or this SO questions to find a proper solution.

Community
  • 1
  • 1
Stas
  • 641
  • 8
  • 16