TabBarController DidSelectViewController返回VC

时间:2016-09-12 00:02:54

标签: ios objective-c uitabbarcontroller

在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中它工作正常时,但只要我选中另一个标签然后回来,它就永远不会被调用。

0 个答案:

没有答案