因為經(jīng)常用,但是還老忘
所以就記一下??
自定義view里利用到UITabBarController控制器 modal 出來的導航控制器push
UIViewController *root = [UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *nav = (UINavigationController *)root.presentedViewController;
[nav pushViewController:<#(nonnull UIViewController *)#> animated:YES];
//上面不行就這個
UITabBarController *tabBarVc = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
UINavigationController *Nav = [tabBarVc selectedViewController];
[Nav pushViewController:<#(nonnull UIViewController *)#> animated:YES];
//swift present
let loginVC = BLLoginVc()
let nav:UINavigationController = UINavigationController.init(rootViewController: loginVC)
nav.modalPresentationStyle = .fullScreen
self.window?.rootViewController?.present(nav, animated: true)