iPhone - how to find a parent View

Posted by Oscar Peli on Stack Overflow See other posts from Stack Overflow or by Oscar Peli
Published on 2010-04-27T10:30:37Z Indexed on 2010/04/27 10:33 UTC
Read the original article Hit count: 440

Filed under:
|

Hi there,

I need some help to find a View inside a hierarchy.

Here is how I build up the View stack.

Inside my first UITableViewController I push an UIViewController that contains an UITabBarController:

[[self navigationController] pushViewController:itemVC animated:YES];

Inside the UITabBarController I add an UITableViewController:

 ISSTableViewController *graphics = (ISSTableViewController *)[tabBarController.viewControllers objectAtIndex:3];

Inside the didSelectRowAtIndexPath I present a Modal View Controller using a UINavigationController:

 GraficoViewController *graph = [[GraficoViewController alloc] initWithNibName:@"GraficoViewController" bundle:nil];
  UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:graph];
  [self presentModalViewController:navigationController animated:YES];    
  [navigationController release];

Now the (BIG) question is: I have to hide the NagivationBar of my first UITableViewController inside my last view. I tried with this:

 [[[[[self parentViewController] parentViewController] parentViewController] navigationController] setNavigationBarHidden:YES];

but it doesn't work. Can someone tell me how I can find my ancestor View??? Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiviewcontroller