RegisterViewController *registerViewController = [RegisterViewController new];
[self.NavigationController pushViewController:registerViewController animated:YES];
//返回到根視圖
[self.navigationController popToRootViewControllerAnimated:YES];
//返回到指定視圖
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:[LoginViewController class]]) {
[self.navigationController popToViewController:controller animated:YES];
}
}
這種采用壓棧和出棧進(jìn)行頁面跳轉(zhuǎn)的方式,就是出入棧跳轉(zhuǎn)。
SelectViewController * selectViewController = [[SelectViewController alloc] init];
//把當(dāng)前控制器作為背景
self.definesPresentationContext = YES;
//設(shè)置模態(tài)視圖彈出樣式
selectViewController.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self presentViewController:selectViewController animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:NULL];
模態(tài)跳轉(zhuǎn)主要在:收集用戶輸入信息,臨時(shí)展示一些內(nèi)容,顯示一個(gè)新的view層級(jí)等時(shí)候會(huì)用到。