简体   繁体   中英

UITabbar Tab change animation show black glitch at time of transition

I am working with UITabBarController in which i have added transition when user switch tabs and it is working fine in iOS 8 but it iOS 9 it is showing black color at the time of transition.

Below is the code which i am using right now.

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {

    NSInteger destinationViewControllerIndex = [self.viewControllers indexOfObject:viewController];

    if ([self selectedIndex]==destinationViewControllerIndex) {
        // If Source and Destination Controller both are same return YES
        return YES;
    }
    // Push Animation when tabbar change
    CATransition *animation = [CATransition animation];
    [animation setType:kCATransitionPush];
    if ([self selectedIndex]>destinationViewControllerIndex) {
        [animation setSubtype:kCATransitionFromLeft];
    }else{
        [animation setSubtype:kCATransitionFromRight];
    }
    [animation setDuration:0.35];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                              kCAMediaTimingFunctionEaseIn]];
    [self.view.window.layer addAnimation:animation forKey:@"fadeTransition"];

    return YES;
}

使用者切换分页时看起来像这样

I saw something very similar to this with some custom transition animations in iOS 9.

In the end, the solution was to disable translucency (self.tabBar.translucent = NO;) on the UITabBar object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM