2011-12-15 27 views
0

我對將UINavigationController管理到ModelView有點困惑。我在RootView中有一個UINavigationController,並且我希望基於RootView從下往上彈出另一個模型視圖,同時讓NavigationController停留在模型視圖中,以便我仍然可以導航到下一個模型視圖。如何實現?如何在modelView中保留UINavigationController

回答

1

您可以在RootView中創建您的導航控制器。假設你想在RootView顯示按鈕點擊模式的看法:

- (IBAction) showModalView 
{ 
     YourModalView * aYourModalView = [[YourModalView alloc] initWithNibName:@"YourModalView" bundle:nil]; 
     UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:aYourModalView]; 
     aYourModalView.navigationController.navigationBar.hidden = YES ; 

     [self.navigationController presentModalViewController:navigation animated:YES]; 
     [aYourModalView release]; 
} 

現在,你的模式視圖具有導航控制器,你可以從模態視圖使用推VCS:

[self.navigationController pushViewController:aViewController animated:YES]; 

希望它可以幫助你。 ..

0

您可以在UINavigationController使用

- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated 

方法。只要不動畫,並將該數組的索引0處的對象更改爲新的RootView。