Objective c 如何通过TabBarController=>;从Appdelegate显示视图控制器;导航控制器
如何从appdelegate向视图控制器显示所有堆栈。Objective c 如何通过TabBarController=>;从Appdelegate显示视图控制器;导航控制器,objective-c,uinavigationcontroller,uitabbarcontroller,appdelegate,presentviewcontroller,Objective C,Uinavigationcontroller,Uitabbarcontroller,Appdelegate,Presentviewcontroller,如何从appdelegate向视图控制器显示所有堆栈。 TabBarContoller是rootviewcontoller。 我在TabBarController上有4个选项卡,每个选项卡都是导航控制器。 所以我需要像这样展示viewcontroller。 tabBar=>navBar=>mainviewcontroller=>aViewController=>bViewController; 我应该能够使用导航回到mainviewcontroller或通过tabbar进行导航 我有一个故事板
TabBarContoller是rootviewcontoller。
我在TabBarController上有4个选项卡,每个选项卡都是导航控制器。
所以我需要像这样展示viewcontroller。 tabBar=>navBar=>mainviewcontroller=>aViewController=>bViewController;
我应该能够使用导航回到mainviewcontroller或通过tabbar进行导航 我有一个故事板
我尝试了很多类似问题推荐的解决方案,但都没有用。您应该只通过故事板来实现这一点 我尝试使用示例项目。我成功地运行了它。我向您展示了故事板设计
它使用多个视图控制器实现。我认为这可能对所有的雨燕都有帮助。我有一个类似的项目设置,LoginViewcontroller->TabBarController(5个选项卡)->每个选项卡的NavigationController->其他ViewController
TabBarController * tabBar = (TabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController;
if([tabBar isKindOfClass:[UITabBarController class]]){
[tabBar setSelectedIndex:0];
UINavigationController * navBar = (UINavigationController *)tabBar.selectedViewController;
UIViewController * currentVC = navBar.topViewController;
[currentVC performSegueWithIdentifier:@"notificationSegue" sender:nil];
在情节提要中,我给了TabBarController一个情节提要ID
在AppDelegate(didFinishLaunchingWithOptions)中,我添加了
将selectedIndex值更改为您需要的任何选项卡谢谢您的评论,但我需要从appdelegate获得演示文稿,方法是将所有内容推送到特定的viewcontroller。然后您应该使用xib而不是故事板。
self.window = UIWindow(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard.init(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "TabBarControllerID") as! UITabBarController
viewController.selectedIndex = 3
self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()