我正在使用navigationcontroller让用户在不同的视图之间导航。问题是导航控制器在某种程度上重用了我已经弹出的视图,但我不想要这种行为。
我怎样才能确定导航控制器不会在内存中保留任何内容?也不是xib文件?
感谢你。
修改
这是我用来推送的代码
VisualViewController *visualController = [[VisualViewController alloc] init];
CATransition *transition = [CATransition animation];
transition.duration = 0.4;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromRight;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:@"GoToVisualAnimation"];
[self.navigationController pushViewController:visualController animated:NO];
[visualController release];
并弹出:
CATransition *transition = [CATransition animation];
transition.duration = 0.75;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionReveal;
transition.subtype = kCATransitionFromLeft;
transition.delegate = self;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController popViewControllerAnimated:NO];
希望它有所帮助。
谢谢!
答案 0 :(得分:0)
这将确保您弹出正确的View Controller。
for(UIViewController *myVC in self.navigationController.viewControllers){
NSLog(@"Current View Controller@%@",myVC);
if ([myVC isKindOfClass:[[NameOftheViewControllerYouSeek] class]]) {
NSLog(@"You found the right View Controller");
[self.navigationController setNavigationBarHidden:NO animated:NO];
[self.navigationController popToViewController:myVC animated:YES];
}