导航问题?

时间:2011-01-12 11:55:47

标签: iphone

我有一个视图A,我有一个代码,可以使用以下命令将其推送到B [navController pushViewController:SecondViewController animated:YES];

当我到达并按回按钮时,按钮显示firstViewcontroller。 但是当我再次按下按钮再次将其推到第二个视图时。 而不是显示'firstviewcontroller'按钮说secondviewcontroller。 由于某种原因,我的导航堆栈正在添加和添加第二个视图。

有人可以告诉我我做错了什么吗? 我在代码中找不到任何问题。

编辑: 我已将代码更改为:

FirstViewController *aFirstViewController = [[FirstViewController alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]];
        [navController pushViewController:aFirstViewController animated:YES];
        [aFirstViewController release];

它仍然无效:S

1 个答案:

答案 0 :(得分:-1)

我想你还没有发布你的SecondView的对象..... 无论如何把它放在你给你导航代码的地方

SecondViewController *viewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:viewController animated:YES];
    [SecondViewController release];
相关问题