How to get visible viewController from app delegate when using storyboard?

后端 未结 14 1681
小蘑菇
小蘑菇 2020-12-05 00:14

I have some viewControllers, and I don\'t use NavigationController. How can I get visible view controller in app delegate methods (e.g. appli

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 01:01

    In my case i have Tabbar controller and then Navigation controller for each Tab hope it helps someone

     UIViewController *loginViewController=self.window.rootViewController;
    
     UITabBarController *controller=loginViewController.tabBarController;
    
     UIViewController *CurrentController = controller.selectedViewController.childViewControllers.lastObject;
    

提交回复
热议问题