我有选项卡式iOS应用程序。我需要知道哪个选项卡处于活动状态,并检测选项卡更改的时间。在故事板中,我有一个选项卡视图控制器,当您单击一个选项卡时更改视图。我创建了一个类TabBarController
和它的定义如下:iOS检测标签是否被更改
部首
@interface TabBarController : UITabBarController <UITabBarControllerDelegate>
@end
实施
#import "TabBarController.h"
@implementation TabBarController
// In the initialization section, set the delegate
- (id) init
{
self = [super init];
if (self)
{
self.delegate = self;
}
return self;
}
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController
{
NSLog(@"controller class: %@", NSStringFromClass([viewController class]));
NSLog(@"controller title: %@", viewController.title);
}
@end
然而,我无法检测到与上述代码标签的变化。你认为这个问题是什么?
我没有将我的标签页视图链接到任何网点,但是转到其他视图。这是问题吗?那么,我应该在哪里连接我的插座?
为什么在接受O_o时如此低估? – Alfabravo 2017-06-12 18:22:03