Skip to content

Swift版本的iOS常用转场动画(包括自定义和iOS自带转场动画)

License

Notifications You must be signed in to change notification settings

gsyhei/GXTransition-Swift

Repository files navigation

GXTransition-Swift

Swift版本的iOS常用转场动画(包括自定义和iOS自带转场动画)。 有建议可以联系QQ交流群:1101980843,喜欢就给个star哦,谢谢关注!

Sample renderings

Requirements

Usage in you Podfile:

pod 'GXTransition-Swift'
pod 'GXTransition'

使用方法

首先 import GXTransition-Swift,然后直接使用扩展方法就行,是不是很简单😁。

/// push
/// - Parameters:
///   - viewController: 目标vc
///   - style: 转场动画类型
///   - style注意事项:不支持cube与oglFlip,push动画不支持transitionContext.containerView.layer.sublayerTransform
///   - subtype: 转场动画方向
///   - interacting: 是否开启手势返回
///   - rectEdges: 自定义返回手势方向(注意这里只有left/right)
func gx_push(_ viewController: UIViewController,
             style: GXAnimationStyle,
             subtype: GXAnimationSubtype = .left,
             interacting: Bool = true,
             rectEdges: UIRectEdge = .left)
{
    self.gx_gotoViewController(vc: viewController,
                               isPush: true,
                               style: style,
                               subtype: subtype,
                               interacted: interacting,
                               rectEdges: rectEdges,
                               completion: nil)
}

/// present
/// - Parameters:
///   - viewControllerToPresent: : 目标vc
///   - style: 转场动画类型
///   - subtype: 转场动画方向
///   - interacting: 是否开启手势返回
///   - rectEdges: 自定义返回手势方向(注意这里只有left/right)
///   - completion: 完成回调
func gx_present(_ viewControllerToPresent: UIViewController,
                style: GXAnimationStyle,
                subtype: GXAnimationSubtype = .left,
                interacting: Bool = true,
                rectEdges: UIRectEdge = .left,
                completion: (() -> Void)? = nil)

支持的转场动画类型

public enum GXAnimationStyle: Int {
    case push      = 0
    case pushEdge  = 1
    case pushAll   = 2
    case sector    = 3
    case cube      = 4
    case oglFlip   = 5
}

License

MIT

About

Swift版本的iOS常用转场动画(包括自定义和iOS自带转场动画)

Resources

License

Stars

Watchers

Forks

Packages

No packages published