如何获得在iphone上切换标签菜单的事件 [英] how to get the event that switch tab menu on iphone
本文介绍了如何获得在iphone上切换标签菜单的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在试图弄清楚如何捕获控制
UITabBarController
上的开关标签的事件。我怎么能做到这一点?
I'm trying to figure out how to catch the event that controls the switch tabs on the
UITabBarController
. How could I accomplish this?
推荐答案
如果您使用的是storyboard,请在didFinishLaunchingWithOptions中执行此操作
If you are using storyboard, do this
UITabBarController *tabBar = (UITabBarController *)self.window.rootViewController;
[tabBar setDelegate:self];
同样在AppDelegate中,保持< UITabBarControllerDelegate>
Also in AppDelegate, keep <UITabBarControllerDelegate>
然后
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
//Write your code here
}
这篇关于如何获得在iphone上切换标签菜单的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文