我在导航上有一个视图。 现在我点击按钮进行跟踪。
[self.navigationController popViewControllerAnimated:YES];
FreeStuffViewController * freeStuffVC=[[FreeStuffViewController alloc]initWithNibName:@"FreeStuffViewController" bundle:nil];
[self.navigationController pushViewController:freeStuffVC animated:YES];
[freeStuffVC release];
它只会弹出一个视图,但是dint会推送新的FreeStuffVc。 请帮忙。
答案 0 :(得分:2)
试试这个:
FreeStuffViewController * freeStuffVC=[[FreeStuffViewController alloc] initWithNibName:@"FreeStuffViewController" bundle:nil];
[self.navigationController pushViewController:freeStuffVC animated:YES];
NSMutableArray *viewArray = [[self.navigationController viewControllers] mutableCopy];
[viewArray removeObjectAtIndex:viewArray.count - 2];
self.navigationController.viewControllers = viewArray;
答案 1 :(得分:0)
这很好用。检查
UINavigationController *local = [[UINavigationController alloc]init];
[local popViewControllerAnimated:NO];
newView *nr=[[newView alloc]init];
[self.navigationController pushViewController:nr animated:YES];