开发者

navigation problem?

开发者 https://www.devze.com 2023-02-03 15:53 出处:网络
I have a view A where I have a code to push it to view B using: [navController pushViewController:SecondViewController animated:YES];

I have a view A where I have a code to push it to view B using: [navController pushViewController:SecondViewController animated:YES];

when I get there and press back, the button says firstViewcontroller. But when I press the buttons again to push it to the secondview again. instead of showing 'firstviewcontroller' the buttons says secondviewcontroller. and for some reason, my navigation-stack is adding and adding the secondview.

Can som开发者_如何学Goeone tell me what I do wrong? I can't find any problem in my code.

Edit: I have changed my code to:

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

and it is still not working:S


I think u had not released the object of your SecondView..... Anyways Put this at the place where u r giving your navigation code

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

精彩评论

暂无评论...
验证码 换一张
取 消