2012-07-16 23 views
0

我的視圖包含註冊按鈕,它以模態方式顯示註冊視圖,我想在uinavigationcontroller中註冊此註冊,如何在uinavcontroller中添加此視圖。如何添加顯示爲模式的uinavcontroller中的視圖

+0

的問題不是很清楚。任何'UIViewController'都可以通過'pushViewController:animated'添加到導航堆棧中。如果你只是需要一個導航欄爲你的模式視圖控制器,那麼只需將'UIViewController'封裝在'UINavigationController'中。 – onegray 2012-07-16 13:50:52

+0

使用'[self.view addSubview:signupView]'? – 2012-07-16 13:51:57

回答

2

只要有你的按鈕的操作方法目前導航控制器是這樣的:

-(IBAction)showSignup:(id)sender { 
    MyViewController *signupController = [[MyViewController alloc] init]; 
    //Other setup for signupController; 

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:signupController]; 

    //Set modal presentation and transition styles, if needed. 

    [self presentModalViewController:navController animated:YES]; 
} 
+0

感謝您的回覆:) – 2012-07-17 05:26:46

相關問題