我有这样的视图控制器和实现:
loginViewController = [[LoginViewController alloc] init];
loginViewController.delegate = self;
[self.view addSubview:loginViewController.view];
[self addChildViewController:loginViewController];
[loginViewController didMoveToParentViewController:self];
在loginViewController里面,我想显示另一个视图控制器,但我实现如下:
otherViewController = [[OtherViewController alloc] initWithNibName:nil bundle:nil];
otherViewController.delegate = self;
[self presentViewController:otherViewController animated:YES completion:nil];
每次我使用otherViewController并想要关闭视图控制器[self dismissViewControllerAnimated:YES completion:nil];
它从头开始重新启动而没有显示loginViewController。我尝试使用Debug View Hierarchy进行检查,并且在调用presentViewController:otherViewController
时没有实现loginViewController
为什么会这样?