CCKWaveCollectionViewTransition 1.2.0

CKWaveCollectionViewTransition 1.2.0

测试已测试
语言语言 SwiftSwift
许可 没有声明
发布最新发布2019年10月
SPM支持SPM

Cezary Kopacz维护。



  • 作者:
  • Cezary Kopacz

CKWaveCollectionViewTransition

这是一个酷炫的自定义过渡效果,可以在两个或更多UICollectionViewControllers之间实现类似于波浪的cell动画。可以用于例如画廊等。

anim.gif

动画灵感来源于Łukasz FrankiewiczDribble项目

安装

有两种选择:

  • 通过CocoaPods。
  • 手动将文件添加到您的Xcode项目中。稍微简单一些,但更新也是手动的。

使用

  • 在Storyboard中,向您的NavigationController中添加一个对象。

object.jpg

  • 将其类设置为NavigationControllerDelegate

objectCustomClass.jpg

  • 将NavigationController代理设置为该对象。

navigationControllerDelegateObject.jpg

或者

在您的ViewController中实现UINavigationControllerDelegate。

func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation,
        fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
            let animator = CKWaveCollectionViewAnimator()
            if operation != UINavigationControllerOperation.Push {
                animator.reversed = true
            }

            return animator
    }
  • 最后要设置的是在didSelectItemAtIndexPath方法实现中设置selectedIndexPath属性。
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        selectedIndexPath = indexPath
}

属性

internal let animationDuration: Double! = 1.0

总动画时长。

internal let kCellAnimSmallDelta: Double! = 0.01
internal let kCellAnimBigDelta: Double! = 0.03

您可以通过更改这些属性来调整动画。

要求

  • iOS 7.0+

版权

遵循 MIT 许可证发布。更多信息请参阅 LICENSE 文件。