【发布时间】:2010-07-22 15:32:13
【问题描述】:
我有一个问题,现在一整天都找不到解决方案。我是 iPhone SDK 的新手,所以我想我只是错过了一些东西。
我的应用由一个 TabbedNavigation 组成,具有三个 ViewController。一切都按预期工作。现在,当用户单击按钮(而不是选项卡按钮...)时,我想打开一个新视图(最好从 NIB 中)。按钮的操作方法按预期调用。但是,我没有加载新的(表格)视图。
我试着给你一些代码来解释我的情况:
首先,在我的应用程序委托的 didFinishLaunchingWithOptions 中,我加载了 tabBarController 的视图(TabBarController 是委托的属性):
// Add the tab bar controller's view to the window and display.
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
TabController 的第一个 ViewController 在应用程序启动时显示,正如预期的那样。这个 viewController 有它的自定义 ViewController 类,按钮的动作方法位于其中。我的操作方法如下所示:
-(IBAction)filtersButtonPressed:(id)sender {
FiltersTableViewController *filtersViewController =
[[FiltersTableViewController alloc] initWithNibName:@"Filters" bundle:nil];
[[[super tabBarController] navigationController] pushViewController:filtersViewController];
}
不知何故,这不起作用...我当然尝试了几件事 - 没有成功。
你们中有人能指出我正确的方向吗?只需按一下按钮即可获得新视图并没有那么难...
提前致谢!
雪儿,宝贝
【问题讨论】:
标签: iphone uitableview sdk uiviewcontroller uitabcontroller