iPhone-如何找到父视图
我需要一些帮助来找到层次结构中的视图 下面是我如何构建视图堆栈的 在我的第一个UITableViewController中,我推送一个包含UIAbbarController的UIViewController:iPhone-如何找到父视图,iphone,uiviewcontroller,Iphone,Uiviewcontroller,我需要一些帮助来找到层次结构中的视图 下面是我如何构建视图堆栈的 在我的第一个UITableViewController中,我推送一个包含UIAbbarController的UIViewController: [[self navigationController] pushViewController:itemVC animated:YES]; ISSTableViewController *graphics = (ISSTableViewController *)[tabBarContr
[[self navigationController] pushViewController:itemVC animated:YES];
ISSTableViewController *graphics = (ISSTableViewController *)[tabBarController.viewControllers objectAtIndex:3];
GraficoViewController *graph = [[GraficoViewController alloc] initWithNibName:@"GraficoViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:graph];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
在UITableViewController中,我添加了一个UITableViewController:
[[self navigationController] pushViewController:itemVC animated:YES];
ISSTableViewController *graphics = (ISSTableViewController *)[tabBarController.viewControllers objectAtIndex:3];
GraficoViewController *graph = [[GraficoViewController alloc] initWithNibName:@"GraficoViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:graph];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
在didSelectRowAtIndexPath中,我使用UINavigationController呈现了一个模态视图控制器:
[[self navigationController] pushViewController:itemVC animated:YES];
ISSTableViewController *graphics = (ISSTableViewController *)[tabBarController.viewControllers objectAtIndex:3];
GraficoViewController *graph = [[GraficoViewController alloc] initWithNibName:@"GraficoViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:graph];
[self presentModalViewController:navigationController animated:YES];
[navigationController release];
现在(大)问题是:
我必须将第一个UITableViewController的NagivationBar隐藏在最后一个视图中。
我试过这个:
[[[[[self parentViewController] parentViewController] parentViewController] navigationController] setNavigationBarHidden:YES];
但它不起作用。
有人能告诉我怎样才能找到我的祖先观吗???
谢谢。将指向UINavigationController的指针(作为属性)存储在应用程序委托或自定义单例对象中。然后,您可以从任何地方访问导航。我考虑过这一点,但我正在寻找一个更干净的解决方案。这是一个很好的解决方案,因为如果您更改控制器层次结构,它将在不更改的情况下工作。