本文介绍了如何从标签栏控制器获取“当前”导航控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有方法检索标签栏控制器当前的可见导航控制器?
Is there is a method to retrieve tab bar controller's current visible navigation controller?
例如,我的程序中有2个标签栏(每个导航控制器一个)下面
For example, I have 2 tabbars in my program (one navigation controller each) as below
- (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;
}
任何人都可以告诉我如何确定当前的导航控制器以便我可以将更多的viewcontrollers推到它上面?
Can anyone advise me how I can determine the current navigation controller so that I can push more viewcontrollers onto it?
推荐答案
使用 selectedViewController属性。
Use the UITabBarController
s selectedViewController property.
navcon = (UINavigationController*)myTabBarController.selectedViewController;
[navcon pushViewController:someViewController animated:YES];
这篇关于如何从标签栏控制器获取“当前”导航控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!