【问题标题】:UITabbar Tab change animation show black glitch at time of transitionUITabbar 选项卡更改动画在过渡时显示黑色故障
【发布时间】:2015-11-17 06:29:54
【问题描述】:

我正在使用 UITabBarController,我在其中添加了用户切换选项卡时的转换,它在 iOS 8 中运行良好,但在 iOS 9 中,它在转换时显示黑色。

下面是我现在使用的代码。

- (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;
}

【问题讨论】:

标签: ios objective-c animation uitabbar catransition


【解决方案1】:

我在 iOS 9 中看到了一些与此非常相似的自定义过渡动画。

最后,解决方案是在 UITabBar 对象上禁用半透明(self.tabBar.translucent = NO;)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    • 1970-01-01
    相关资源
    最近更新 更多