1.模态跳转
这种方法也是目前网上最多的一种方法,具体代码如下:
MessageViewController *VC = [[MessageViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:VC];
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
2.Push跳转
有时候我们根据需求,需要使用push方法跳转页面,让跳转更舒服,
具体代码如下:
UITabBarController *tab = (UITabBarController *)_window.rootViewController;
UINavigationController *nav = tab.viewControllers[tab.selectedIndex];
MessageViewController *vc = [[MessageViewController alloc] init];
vc.hidesBottomBarWhenPushed = YES;
[nav pushViewController:vc animated:YES];
网友评论