iPhone:选择选项卡栏中的表格单元格时更改视图
我有一个有 2 个视图的 UITabBar。 一个视图包含一个 UITable。当我选择一个单元格时,我想导航到另一个视图。
我总是用这段代码来做到这一点:
if(self.damageController == nil)
{
DamageControllerOverview *viewTwo = [[DamageControllerOverview alloc] initWithNibName:@"DamageControllerOverview" bundle:[NSBundle mainBundle]];
self.damageController = viewTwo;
self.damageController.damageAccount = damageAccount;
self.damageController.ma = ma;
[self.navigationController setNavigationBarHidden:NO animated:NO];
temporaryBarButtonItem = [[UIBarButtonItem alloc] init];
temporaryBarButtonItem.title = @"Back";
self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
[viewTwo release];
}
[self.navigationController pushViewController:self.damageController animated:YES];
但是由于我在选项卡栏中有表格,所以它不再工作了。 有人知道为什么吗?
此致 梅兰妮
*编辑: 这不是我的根视图控制器。 我已经有一个导航控制器,并且不想在选项卡栏中创建新的导航控制器
I have a UITabBar with 2 views.
One view contains a UITable. When I am selecting a cell I want to navigate to another view.
I always did it with this code:
if(self.damageController == nil)
{
DamageControllerOverview *viewTwo = [[DamageControllerOverview alloc] initWithNibName:@"DamageControllerOverview" bundle:[NSBundle mainBundle]];
self.damageController = viewTwo;
self.damageController.damageAccount = damageAccount;
self.damageController.ma = ma;
[self.navigationController setNavigationBarHidden:NO animated:NO];
temporaryBarButtonItem = [[UIBarButtonItem alloc] init];
temporaryBarButtonItem.title = @"Back";
self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
[viewTwo release];
}
[self.navigationController pushViewController:self.damageController animated:YES];
But since I have the table in the Tabbar it is not working anymore.
Does anybody know why?
Best regards
Melanie
*Edit:
this is not my rootviewcontroller.
I already have a navigationcontroller and don't want to create a new one in the tabbar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从你的问题中了解到的是
1-你在主窗口中有一个
tabbar
2-然后标签栏中就有一个
navigationController
。所以你需要通过这种方式将控制器推送到navigationController。
而不是
[
self.navigationController PushViewController:self.damageControlleranimated:YES];
我希望它有帮助
What i understand from your question is that
1- you have a
tabbar
in the main window2-then you have a
navigationController
in the tabbar.so you need to push your controller to the
navigationController
this way.instead of
[
self.navigationController pushViewController:self.damageController animated:YES];
I hope it helps