KelvinJin/AnimatedCollectionViewLayout
关于
一个 UICollectionViewLayout 子类,可为 UICollectionView 添加自定义过渡效果和动画,且不影响现有代码。
创作与媒体实测星标增长
- 24小时
- 0
- 7天
- -1
- 15天
- -3
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文AnimatedCollectionViewLayout
Normally a UICollectionView has no transition effects when you scroll from one item to another. There are lots of ways to write animations for UICollectionView, but using a UICollectionViewLayout subclass is by far the simplest one. And it doesn't break any of your existing code. You can still use your UICollectionView subclass and you don't need to change your UICollectionViewCell. Just plug and enjoy.
| Parallax | ZoomInOut | RotateInOut | Cards |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| CrossFade | Cube | Page | |
![]() |
![]() |
![]() |
Example
To run the example project, clone the repo, and start iOS Example in Xcode.
Requirements
- iOS 9.0+
Installation
CocoaPods
To integrate AnimatedCollectionViewLayout into your Xcode project using CocoaPods, specify it in your Podfile:
For Swift 4.2 or above:
pod 'AnimatedCollectionViewLayout'
For Swift 4.1 or below:
pod 'AnimatedCollectionViewLayout', '~> 0.3.0'
Carthage & SPM
Carthage and Swift Package Manager are also supported.
Usage
Get Started
Import the library where you want to use it. Create a AnimatedCollectionViewLayout object, set its animator and assign it to your UICollectionView.
import AnimatedCollectionViewLayout
// ...
let layout = AnimatedCollectionViewLayout()
layout.animator = ParallaxAttributesAnimator()
collectionView.collectionViewLayout = layout
Customization
Most of the built-in animators work best in Paging mode and they have additional parameters that you can tweak for better transitions.
You can also write your own animators by implementing the protocol LayoutAttributesAnimator.
Author
License
AnimatedCollectionViewLayout is available under the MIT license. See the LICENSE file for more info.
探索相关项目
加载中…






