Latest 1.3
Homepage https://github.com/tungvoduc/DTParallaxViewController
License MIT
Platforms ios 8.0
Authors

[![CI Status](http://img.shields.io/travis/Tung Vo/DTParallaxScrollViewController.svg?style=flat)](https://travis-ci.org/Tung Vo/DTParallaxScrollViewController)
Version
License
Platform

Example

DTParallaxScrollView is a custom UIView that creates parallax scroll view vertical effects. You can use it to apply the effect to your UITableView or UICollectionView or UIScrollView in general.

For example, if you want to have a map view on top of a table view and you want to be able to interact with both the map view and table view without any conflictions.

You can subclass DTParallaxScrollViewController, and then call this in initializer:

super.init(scrollView: tableView, headerHeight: kHeaderHeight)

where scrollView is the view you want to apply parallax effect and headerHeight is height of header.

set delegate for parallax scroll view controller

self.delegate = object

conforms DTParallaxScrollViewDelegate in deleget object

func parallaxScrollViewViewForHeader(viewController: DTParallaxScrollView) -> UIView {
    return mapView
}

Here is how you make parallax effect

self.updateBlock = {(yOffset: CGFloat, visible: Bool) -> Void in
    if yOffset < 0 {
        let scaleFactor = 1 + abs(yOffset/self.headerHeight)
        self._mapView.transform = CGAffineTransformMakeScale(scaleFactor, scaleFactor)
    }
    else {
        self._mapView.transform = CGAffineTransformIdentity
    }
}

Instead of using DTParallaxScrollViewController, you can also use DTParallaxScrollView to achieve the same effect.

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

DTParallaxScrollViewController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "DTParallaxScrollViewController"

Author

Tung Vo, [email protected]

License

DTParallaxScrollViewController is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DTParallaxScrollViewController",
    "version": "1.3",
    "summary": "DTParallaxScrollViewController provides the parallax effect for scroll view.",
    "description": "DTParallaxScrollViewController provides the parallax effect for scroll view. Multiple scroll views can be interactive at the same time.",
    "homepage": "https://github.com/tungvoduc/DTParallaxViewController",
    "license": "MIT",
    "authors": {
        "Tung Vo": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tungvoduc/DTParallaxViewController.git",
        "tag": "1.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DTParallaxScrollViewController/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This