美文网首页
iOS 从AppDelegate中跳转指定页面

iOS 从AppDelegate中跳转指定页面

作者: wo一人两袖清风 | 来源:发表于2017-08-15 10:00 被阅读0次

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];

相关文章

网友评论

      本文标题:iOS 从AppDelegate中跳转指定页面

      本文链接:https://www.haomeiwen.com/subject/apdmrxtx.html