LNParallaxHeader
LNParallaxHeader copied to clipboard
UICollectionView header with parallax effect
LNParallaxHeader
Header parallax effect in UICollectionView
Requirements
- iOS 10.0+
- Xcode 11
- Swift 5
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate LNParallaxHeader into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'LNParallaxHeader'
Manually
If you prefer not to use any of the aforementioned dependency managers, you can integrate LNParallaxHeader into your project manually.
Usage
- You can add LNParallaxHeaderFlowLayout to CollectionViewFlowLayout
- Or you can programmatically create
Import LNParallaxHeader module to your class
import LNParallaxHeader
Сustomize for yourself
func prepareCollectionViewLayout() {
let width = UIScreen.main.bounds.size.width
let layout = LNParallaxHeaderFlowLayout(minSize: CGSize(width: width, height: 44.0), size: CGSize(width: width, height: 180.0))
layout.itemSize = CGSize(width: width, height: layout.itemSize.height)
layout.isAlwaysOnTop = true
collectionView.collectionViewLayout = layout
}
Also check out an example project with parallax header view
License
Copyright © 2020 Lanars
https://lanars.com
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.