1.改变window的根视图
[self.window setRootViewController:VC];
2.模态弹出
[self presentViewController:nextVC animated:YES completion:nil];//从当前界面到nextVC [self dismissViewControllerAnimated:YES completion:nil];//从nextVC界面回去
3.UINavigationController push 进来和 pop回去
[self.navigationController pushViewController:nextVC animated:YES];//从当前界面到nextVC这个界面 [self.navigationController popViewControllerAnimated:YES];//nextVC这个界面回到上一界面 [self.navigationController popToRootViewControllerAnimated:YES];//回到根视图界面 //self.navigationController.viewControllers 是一个数组里面存放所有之前push过来的界面,如果想要跳回到指定界面 只需要根据索引值取出响应的界面pop回去 MainViewController *MainVC =self.navigationController.viewControllers[1]; [self.navigationController popToViewController:MainVC animated:YES];
网友评论