0

I am putting a UINavigationController inside a container view like so (this in a full screen UIViewController subclass):

  UIViewController *litteViewController = [[UIViewController alloc]initWithNibName:nil bundle:nil];
  UINavigationController *littleNavigator = [[UINavigationController alloc]initWithRootViewController:litteViewController];

  UIView *containerView = [[UIView alloc]initWithFrame:CGRectMake(100.0, 100.0, 250.0, 320.0)];
  littleNavigator.view.frame = containerView.bounds;

  [self addChildViewController:littleNavigator];

  [containerView addSubview:littleNavigator.view];
  [self.view addSubview:containerView];

  [littleNavigator didMoveToParentViewController:self];

Now this works as expected and littleViewController appears in the rect I expect with a nav bar at top. Now let us say as a result of some interaction inside littleViewController something like this happens

 -(void)someButtonAction:(id)sender{

       UIViewController *secondLittleViewController = [[UIViewController alloc]initWithNibName:nil bundle:nil];
       [self.navigationController presentModalViewController:secondLittleViewController animated:YES];
}

unfortunately this subsequent controller winds up being presented full screen. Now I've done exactly this before inside popoverControllers and splitViewControllers and they've behaved exactly as I want this to, a navigation stack is built within the little rectangle it was started in.

How can I build a navigation stack inside a container over in an arbitrary CGRect?

Lkopo
  • 4,798
  • 8
  • 35
  • 60
Jef
  • 4,728
  • 2
  • 25
  • 33
  • iPhone or iPad? iOS version? – dopcn Sep 14 '14 at 14:12
  • thanks mate. the code I'm looking for should work on any iOs device >= iOs5 (which is where the addChildViewConroller: stuff is) – Jef Sep 14 '14 at 14:16
  • On iPhone and iPod touch, the presented view is always full screen. So you need change to pushViewController – dopcn Sep 14 '14 at 14:36
  • Oh yeah! wow thanks can't believe i forgot that one. thanks so much make it an answer will you? – Jef Sep 14 '14 at 14:41

1 Answers1

1

On iPhone and iPod touch, the presented view is always full screen. So you need change to pushViewController

Glad I can help

dopcn
  • 4,218
  • 3
  • 23
  • 32
  • YEP!! thanks mate. pushViewController: animated: has been there forever and i don't think Ive ever really needed it. Thanks so much – Jef Sep 14 '14 at 14:45