【发布时间】:2011-02-11 09:52:07
【问题描述】:
我有一个非常简单的问题。我有一个视图控制器。在视图控制器中,我添加了几个按钮。单击按钮时,我必须启动一个标签栏控制器(每个都有导航控制器)。
代码片段:
- (IBAction) pushNewsAlertsController:(id)sender {
//Create a navigation controller
UINavigationController *FirstNavController = [[UINavigationController alloc] init] ;
//create the view controller (table view controller)
FirstViewController *firstViewController = [[FirstViewController alloc] init];
[FirstNavController pushViewController:firstViewController animated:YES];
//Create a navigation controller
UINavigationController *secondNavController = [[UINavigationController alloc] init] ;
//create the view controller (table view controller)
SecondViewController *secondViewController = [[SecondViewController alloc] init];
[secondNavController pushViewController:secondViewController animated:YES];
// Set the array of view controllers
tabBarController.viewControllers = [NSArray arrayWithObjects:firstNavController, secondNavController, nil] ;
//Add the tab bar controller's view to the window
[self.view addSubview:tabBarController.view];
}
我可以添加标签视图和导航控制器。问题是单击按钮后我无法返回主视图。
谁能指导我如何返回上一个视图,以便我可以单击其他按钮。
【问题讨论】:
标签: iphone objective-c