• Stars
    star
    1,530
  • Rank 30,597 (Top 0.7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🍎 界面转场动画集

WXSTransition

介绍(Introduce)

It is a transition animation asset。 We can add some transiton animations between view controllers in our iOS Apps . Now,it is easily to do this by this animation asset,even only one line of code. It includes about 50 kinds of animations. Now, it support 4 kinds of gesture for pop view controller. You can see the property in WXSTransitionProperty

这是一个界面转场动画集。 目前只支持纯代码。 在平时开发中,有时候需要一些转场动画给界面调整增添一些活力,而实现这些动画相对比较繁琐。为了让实现转场更简单,我写了这个界面转场动画集。跳转界面时,只要一行代码就可以实现这里面的动画。包括系统提供的动画在内,目前有大概50种动画。

现在已支持手势返回,有四个手势可以选择,可以在WXSTransitionProperty查看相关相关属性

使用方法(Usage)

1、首先导入头文件

#import "UINavigationController+WXSTransition.h"

2、一行代码就可以调用

Push:

 [self.navigationController wxs_pushViewController:(UIViewController *) animationType:(WXSTransitionAnimationType)];

Present:

[self wxs_presentViewController:(UIViewController *) animationType:(WXSTransitionAnimationType) completion:^{

}];

说明: WXSTransitionAnimationType是转场动画类型,通过这个枚举选择你想要的转场动画。

3、支持属性修改(Custom made property)
[self wxs_presentViewController:<#(UIViewController *)#> makeTransition:^(WXSTransitionManager *transition) {
transition.animationType =  WXSTransitionAnimationTypePointSpreadPresent;
transition.animationTime = 1;
}];

可以通过transition设置动画时间、、返回手势、动画类型等属性,可以在WXSTransitionProperty查看相关可修改属性。

像point Spread 、ViewMoveToNextVC这样的动画,需要个起始view,只要将目标控制器的startView指向这个view就可以了,代码如下; view_move_next.gif

[self.navigationController wxs_pushViewController:vc makeTransition:^(WXSTransitionProperty *transition) {
transition.animationType = WXSTransitionAnimationTypeViewMoveToNextVC;
transition.animationTime = 1;
transition.startView  = cell.imgView;
transition.targetView = vc.imageView;
}];

动画效果图

自定义动画

boom:
boom.gif

brick:
brick_close_H.gif brick_open_V.gif

cover:
cover.gif

spread:
point_spread.gif spread_from_right.gif gestureSpread.gif

view move:
view_move_next.gif normalViewMove.gif

frgment:
frgmentFromRight.gif fragmentFromTop.gif

insideThenPush:
insideThenPush.gif

######系统动画 iOS自身其实有许多不错的转场动画,在这个转场动画集里也进行了封装,使用方法跟自定义转场动画一样。

Push:

[self.navigationController wxs_pushViewController:<#(UIViewController *)#> animationType:<#(WXSTransitionAnimationType)#>];

Present:

[self wxs_presentViewController:<#(UIViewController *)#> animationType:<#(WXSTransitionAnimationType)#> completion:<#^(void)completion#>]

sys_oglFlip.gif sys_pageCurl.gif

关于tabbar动画影响效果的问题:

如果tabbar的系统动画影响了效果,可以用一下方法去掉动画。 把 self.hidesBottomBarWhenPushed = YES 去掉 手动控制tabbar的隐藏显示时机: push之前把tabBar隐藏 self.tabBarController.tabBar.hidden = YES; pop后在viewDidApear里显示 self.tabBarController.tabBar.hidden = NO;