场景
在开发中,很多时候会在AppDelegate做一些操作,例如监听网络状况,如若无网络跳转到错误页面。
UIViewController * viewC = weakSelf.window.rootViewController;
UINavigationController * nav;
if ([viewC isKindOfClass:[UITabBarController class]]) {
UITabBarController * tabbarC =(UITabBarController *) viewC;
nav = tabbarC.viewControllers[tabbarC.selectedIndex];
}
else{
nav = viewC.navigationController;
}
[nav pushViewController:checkVC animated:YES];
网友评论