2012-01-31 100 views
0

我知道如何將uinavigationcontroller作爲根視圖添加,以及如何在uinavigationcontroller中推送視圖。如何添加uinavigationcontroller作爲第二個視圖不作爲rootviewcontroller

我在第一個視圖是一個根視圖是一個簡單的視圖與按鈕,當這個按鈕被點擊它會顯示第二個視圖。

我想要第二個視圖爲uinavigationview。

任何想法如何做到這一點,我試圖尋找解決方案,但沒有得到任何也沒有得到任何類似的問題之前被問到。

基本上我正試圖在沒有界面構建器的情況下深入學習東西。

回答

1

假設你呈現的模態

代替

UIViewController *vc = [[[UIViewController alloc] init] autorelease]; 
[self presentModalViewController:vc animated:YES]; 

第二視圖控制器做:

UIViewController *vc = [[[UIViewController alloc] init] autorelease]; 
UINavigationController *nc = [[[UINavigationController alloc] initWithRootViewController:vc] autorelease]; 
[self presentModalViewController:nc animated:YES]; 
+0

不,我不希望目前它模態地將永久陳列。 .. 感謝你的回答。 – supera 2012-01-31 13:48:53

相關問題