0

我正在为 iOS 上的用户身份验证开发一个静态库。

单击按钮时,开发人员将调用我的库的方法并传递当前引用,UINavigationController如下所示:

LoginViewController *LoginView = [LoginViewController alloc]init];
[LoginView ShowLoginScreen : self.navigationController];

ShowLoginScreen:pRootNavController方法中,我正在创建一个UIViewController带有取消按钮的新按钮并将其添加到navigationController如下所示:

LoginViewController * loginscreen = [[LoginViewController alloc] initWithNibName:nil bundle:nil];
self.vRootNavController = pRootNavController 
// provide a funnction here eg ShowLoginScreen( self.navigationController )
[self.vRootNavController pushViewController:loginscreen animated:YES];
[self.vRootNavController setNavigationBarHidden:YES animated:YES];

NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self.vRootNavController.viewControllers];
int size = [navigationArray count];
NSLog(@"No of view controllers are %d",size);

这是记录No of view controllers are 2

单击Cancel按钮时,我想UIViewControllerself.vRootNavController. 在Cancel按钮的事件处理程序中,我这样做:

[self.vRootNavController popViewControllerAnimated:YES];

SMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self.vRootNavController.viewControllers];    
int size = [navigationArray count];
NSLog(@"No of view controllers are %d",size);

问题是在点击Cancel按钮时,电流UIViewController没有被删除,它正在记录No of view controllers are 0

我究竟做错了什么 ?

4

0 回答 0