gpt4 book ai didi

objective-c - 如何从标签栏 Controller 获取 'current' 导航 Controller

转载 作者:IT王子 更新时间:2023-10-29 08:09:56 24 4
gpt4 key购买 nike

是否有一种方法可以检索标签栏 Controller 的当前可见导航 Controller ?

例如,我的程序中有 2 个标签栏(每个标签栏一个导航 Controller ),如下所示

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 
{
//Method is called when user clicks on a hyperlink in one of view controllers
NSDictionary *dict = [self parseQueryString:[url query]];
NSString *userID = [dict objectForKey:@"id"];
NSString *navconTitle = [dict objectForKey:@"navcon"];


//intention is to push a view controller onto the CURRENT navigation stack
[navcon pushViewController:someViewController animated:YES];

}
}

return YES;
}

谁能告诉我如何确定当前的导航 Controller ,以便我可以将更多的 View Controller 推送到它上面?

最佳答案

使用 UITabBarControllers selectedViewController 属性。

navcon = (UINavigationController*)myTabBarController.selectedViewController;
[navcon pushViewController:someViewController animated:YES];

关于objective-c - 如何从标签栏 Controller 获取 'current' 导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6441153/

24 4 0