1.模態(tài)跳轉(zhuǎn)
這種方法也是目前網(wǎng)上最多的一種方法,具體代碼如下:
MessageViewController *VC = [[MessageViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:VC];
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
2.Push跳轉(zhuǎn)
有時候我們根據(jù)需求,需要使用push方法跳轉(zhuǎn)頁面,讓跳轉(zhuǎn)更舒服,
具體代碼如下:
UITabBarController *tab = (UITabBarController *)_window.rootViewController;
UINavigationController *nav = tab.viewControllers[tab.selectedIndex];
MessageViewController *vc = [[MessageViewController alloc] init];
vc.hidesBottomBarWhenPushed = YES;
[nav pushViewController:vc animated:YES];