Skip to content

水平/左右滑动的交互转场动画,通过该转场动画可将UITabBarController作为容器,实现类似天猫商品详情页的效果.

License

Notifications You must be signed in to change notification settings

ONECATYU/WSScrollAnimationTransition

Repository files navigation

demo运行效果如下:


使用

使用WSScrollTransitionDelegate类,重写UITabBarController的init和setViewControllers方法,就能实现左右滑动交互转场.

- (instancetype)init
{
    if (self = [super init]) {
        ///初始化方法中构建实例
        _transitionDelegate = [[WSScrollTransitionDelegate alloc]init];
        _transitionDelegate.tabBarController = self;
    }
    return self;
}

- (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers
{
    [super setViewControllers:viewControllers];
    ///将viewControllers数组传给动画控制器
    ///动画控制需要根据viewControllers中fromVC/toVC的index来确定是向左滑还是向右滑(向下还是向上)
    _transitionDelegate.scrollAnimation.viewCtrollers = viewControllers;
}   

上拉下拉转场时需要注意:
1.先要将动画控制器的scrollDirection设置为WSAnimationScrollDirectionVertical.
2.再设置tabBarController的selectedIndex

About

水平/左右滑动的交互转场动画,通过该转场动画可将UITabBarController作为容器,实现类似天猫商品详情页的效果.

Resources

License

Stars

Watchers

Forks

Packages

No packages published