我正在添加一个子视图控制器,如下所示:
loginViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
loginViewController.delegate = self;
[self addChildViewController:loginViewController];
[self.view addSubview:loginViewController.view];
loginViewController.view.frame = self.view.bounds;
[loginViewController didMoveToParentViewController:self];
并将其删除如下:
[loginViewController willMoveToParentViewController:nil];
[loginViewController.view removeFromSuperview];
[loginViewController removeFromParentViewController];
如果我理解正确,应该在 LoginViewController 中触发 dealloc 但它不会?我错过了什么吗?