i have a problem with the navigationcontroller. i like to push and pop between 2 viewcontrollers. it starts with the first, pushes to the second, pops back an the next push is not working. so pushing from the 1. to the 2. again
Code:
- (void)pushFirstToSecond{
[self.navController popViewControllerAnimated:NO];
[self.navController pushViewController:[[AppViewController alloc] autorelease] animated:NO];
}
- (void)pushBackFromSecondToFirst{
//setting up a new instance of the first view
MainView *contentV = [[MainView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentV setImage:[UIImage imageNamed:@"background.png"]];
[contentV loadVariables];
MainViewController *mainControll = [[MainViewController alloc] init];
[mainControll setView:contentV];
[contentV setUserInteractionEnabled:YES];
UIViewController *controll= mainControll;
UIViewController *viewC = [self.navController topViewController];
[self.navController popViewControllerAnimated:NO];
[self.navController pushViewController:controll animated:NO];
//dont know if i need to release the view of viewC
//[viewC releaseView];
[viewC release];
}
somehow its not working and it seems to be that the second viewcontroller is not released at the time i push it again
because if i dont stop the sounds of it i still hear it operate
i think it pushes back automatically because it still says pushBackFromSecondToFirst if its on the top of the stack.
but if i try to release the view its throwing exeptions.
could some one please help me out
thank you!