当我改变看法,从孩子父母认为,父母的viewWillAppear中的方法不会被调用当我改变看法,从孩子父母认为,父母的viewWillAppear中的方法不会被调用
这是我在父视图代码。
PrivacyViewController *privacy = [[PrivacyViewController alloc]initWithNibName:@"privacyViewController" bundle:nil];
[self addChildViewController:privacy];
[self.view addSubview:privacy.view];
[privacy didMoveToParentViewController:self];
这是我在Child视图中的代码。
-(IBAction)backButton:(UIButton*)button
[self willMoveToParentViewController:nil];
[self.view removeFromSuperview];
[self removeFromParentViewController];
}
似乎我做得对。 10x
viewWillAppear不会接到呼叫,因为您将视图的子视图添加到视图中而不是从一个视图导航到其他视图 – Anupam