在viewDidLoad中我有self.tabBarController.delegate = self;
然后在
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController
{
static UIViewController *previousController = nil;
if (previousController == viewController) {
// the same tab was tapped a second time
dispatch_async(dispatch_get_main_queue(), ^{
[self scrollToTop];
});
}
previousController = viewController;
}
当我在主VC中它工作正常时,但只要我选中另一个标签然后回来,它就永远不会被调用。