首页 > UITabBarController ,滑动来切换它的子控制器,然而tabbar的显示有问题,怎么解决呢??

UITabBarController ,滑动来切换它的子控制器,然而tabbar的显示有问题,怎么解决呢??


- (void)swipe:(UISwipeGestureRecognizer *)gesture {
    
    NSUInteger currentIndex = self.innerTabBarVc.selectedIndex;
    
    CATransition *transaction = [CATransition animation];
    transaction.type = kCATransitionPush;
    if (gesture.direction == UISwipeGestureRecognizerDirectionLeft) {
        [transaction setSubtype:kCATransitionFromRight];
        
        self.innerTabBarVc.selectedIndex = MAX(_innerTabBarVc.childViewControllers.count - 1, currentIndex + 1);
    } else {
        [transaction setSubtype:kCATransitionFromLeft];
        self.innerTabBarVc.selectedIndex = MIN(0, currentIndex - 1);
    }
    
    if (currentIndex == _innerTabBarVc.selectedIndex) {
        return;
    }
    transaction.duration = 5;
    transaction.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    
    [[_innerTabBarVc.view layer] addAnimation:transaction forKey:@"switchView"];
}

这是代码,为什么底部的tabbar会那样显示,而且两个系统下还有差别,代码这样写是有什么问题吗??


第一张gif是iOS8.4下,第二张是iOS9的。。。

【热门文章】
【热门文章】