popToViewController,它不会给我任何崩溃,但是,不打开controllview和动画,所以代码不起作用

时间:2013-07-17 12:48:11

标签: iphone ios objective-c popviewcontroller

UINavigationController *loginNavCon = [[UINavigationController alloc] init];
loginNavCon.navigationController.navigationBarHidden=YES;
loginNavCon.navigationBar.barStyle = UIBarStyleBlack;

//I created navigationcontroller hear

PushMe *p=[[PushMe alloc]initWithNibName:@"PushMe" bundle:[NSBundle mainBundle]];

//这是一个简单的ControllView。只有颜色视图

[loginNavCon pushViewController:p animated:YES];
NSArray *currentViewControllers = [loginNavCon viewControllers];
NSMutableArray *vcs =  [NSMutableArray arrayWithArray:currentViewControllers];

[loginNavCon setViewControllers:vcs animated:NO];
[loginNavCon popViewControllerAnimated:YES];
[loginNavCon popToViewController:p animated:YES];

1 个答案:

答案 0 :(得分:0)

设置根目录:

  

initWithRootViewController:(UIViewController *)rootViewController

如果您弹出,它将返回此VC。