iOS自定义View里面实现控制器跳转

因为经常用,但是还老忘
所以就记一下

自定义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];

你可能感兴趣的:(iOS自定义View里面实现控制器跳转)