2010-11-04 58 views
0

在我的應用程序中,我需要主頁面在視圖頂部包含一個工具欄。這個視圖有一個tableView。所以我的應用程序不能有一個NavigationController。使用工具欄在視圖之間導航

問題

當我想要導航至的tableview細胞,然後我使用的點擊其他視圖「pushViewController:動畫:」方法,但它似乎沒有工作。

我檢查了IB中的連接。他們很好。

如何在沒有導航控制器的頁面之間導航?

我不想爲其他視圖使用模態視圖。

請建議一些方法。

回答

0

您可以使用UINavigationController的實例而不顯示它並將其用於導航。

在你的appDelegate實現中加載你的第一個視圖控制器和UINavigationController的實例。

像:

FirstScreenController *fsc=[[FirstScreenController alloc]initWithNibName:@"FirstScreenController" bundle:nil]; 
UINavigationController *navigation=[[UINavigationController alloc]initWithRootViewController:fsc]; 
navigation.navigationBar.hidden=YES; 
[window addSubview:navigation.view]; 

這裏FirstScreenController可以是具有要顯示在tableviewcell的任何點擊另一視圖中的工具欄和tableview.If您的視圖控制器,這樣調用它。

[self.navigationController pushViewController:secondviewcontroller animated:NO]; 
+1

不要忘記發佈'fsc'。 – Joshua 2010-11-04 07:44:28

+0

謝謝等待,我會嘗試。 – 2010-11-04 07:54:57

+0

非常感謝CodeWriter和Joshua ... It Works !!!!! – 2010-11-04 09:17:14