Latest 0.1.0
Homepage https://github.com/KiranJasvanee/KJNavigationViewAnimation
License MIT
Platforms ios 8.0
Authors

Twitter: @KiranJasvanee
License: MIT
Issues
Forks
Stars
Language

NOTE: Pod version requires 1.2.0 & later

Preview

Animate your custom navigation view using TableView, CollectionView OR ScrollView.

NOTE: In below presentation, if animation looks laggy, wait till page completes it loading. It’s smooth as you scrolls

               Animation up to statusbar                                                                 Animation up to zero

KJNavigationViewAnimation                     KJNavigationViewAnimation

                  Animation up to custom value                                                Animation up to zero without blurr

KJNavigationViewAnimation                     KJNavigationViewAnimation

Example

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

Requirements

  • Swift 3.0.1 or later
  • iOS 9.0 or later

Installation

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

pod 'KJNavigationViewAnimation', '~> 0.1.0'

Usage

KJNavigationViewAnimation will be used via interface builder.

  • Add custom navigation view (UIView) at the top in your interface builder. Add KJNavigationViewAnimation in Class property at Identity Inspector of added view.

  • You’ve to add Height constraint to your added custom navigation view, you don’t have to add any Identifier to it.

    Properties

    Use following properties to edit it’s default functionality. Add your settings in viewDidLoad.

// declare instance of KJNavigationViewAnimation by connecting to UIView outlet in interface builder
@IBOutlet weak var viewKJNavigation: KJNavigationViewAnimation!
override func viewDidLoad() {
        super.viewDidLoad()

        // For TableView
        viewKJNavigation.setupFor(Tableview: yourTableView,
                                  viewController: self)
        // If you want your animation up to statusbar.
        viewKJNavigation.topbarMinimumSpace = .statusBar

        // If you want blurr background of navigation view.
        viewKJNavigation.isBlurrBackground = true

        // assign delegate of TableView, CollectionView OR ScrollView with self.
        tableview.delegate = self
}
// For CollectionView
viewKJNavigation.setupFor(CollectionView: yourCollectionView,
                          viewController: self)
// For ScrollView
viewKJNavigation.setupFor(Scrollview: yourScrollView,
                          viewController: self)
// If you want your animation up to zero.
viewKJNavigation.topbarMinimumSpace = .none
// If you want your animation up to custom value assigned to topbarMinimumSpaceCustomValue property.
viewKJNavigation.topbarMinimumSpace = .custom
viewKJNavigation.topbarMinimumSpaceCustomValue = 40

Methods

You have to extend your viewController class with UIScrollViewDelegate, and connect TableView, CollectionView OR ScrollView delegate to self. Last step to call KJNavigationViewAnimation scrollview methods as below from UIScrollViewDelegate delegate methods

extension ViewController: UIScrollViewDelegate {
  func scrollViewDidScroll(_ scrollView: UIScrollView) {
        // viewKJNavigation is my declared KJNavigationViewAnimation property in ViewController class
        viewKJNavigation.scrollviewMethod?.scrollViewDidScroll(scrollView)
  }
  func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
        viewKJNavigation.scrollviewMethod?.scrollViewWillBeginDragging(scrollView)
  }
  func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
        viewKJNavigation.scrollviewMethod?.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
  }
  func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        viewKJNavigation.scrollviewMethod?.scrollViewDidEndDecelerating(scrollView)
  }
}

Author

Kiran Jasvanee, [email protected]

License

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

Latest podspec

{
    "name": "KJNavigationViewAnimation",
    "version": "0.1.0",
    "summary": "KJNavigationViewAnimation provides navigation view auto animation & blurring",
    "description": "TODO: Add long description of the pod here.nThis library provides custom navigation bar view library, which auto animates and blurrs based on scrolling of Tableview, Collectionview or Scrollview.",
    "homepage": "https://github.com/KiranJasvanee/KJNavigationViewAnimation",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kiran Jasvanee": "[email protected]"
    },
    "source": {
        "git": "https://github.com/KiranJasvanee/KJNavigationViewAnimation.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "KJNavigationViewAnimation/Classes/**/*",
    "pushed_with_swift_version": "3.0.1"
}

Pin It on Pinterest

Share This