跳转一、
界面 AViewController. 按下按下跳转按钮
-(void)clickButton:(id)sender{
[self presentViewController:[[BViewController alloc] init] animated:true completion:^{
//跳转完成后需要执行的事件;
}];
}
界面BViewController 按下返回按钮
- (void)backButton:(id)sender{
[self dismissViewControllerAnimated:true completion:^{
//返回后执行的事件;
}];
}
------------------------------------------------------------------
跳转二、
界面 AViewController. 按下按下跳转按钮
-(void)clickButton:(id)sender{
BViewController *bViewController = [BViewController new];
[self addChildViewController:bViewController];
bViewController.view.frame =self.view.frame;
[self.view addSubview:bViewController.view];
[bViewController didMoveToParentViewController:self];
}
界面BViewController 按下返回按钮
- (void)backButton:(id)sender{
[self willMoveToParentViewController:nil];
[self.view removeFromSuperview];
[self removeFromParentViewController];
}