kjn

KJNavigationViewAnimation

Custom navigation view animation based on dragging & scrolling at TableView, CollectionView OR ScrollView

Showing:

Popularity

Downloads/wk

0

GitHub Stars

65

Maintenance

Last Commit

2yrs ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

THIS PROJECT IS NO LONGER MAINTAINED. SOON WILL COME UP WITH SWIFTUI


KJNavigationViewAnimation

Twitter: @KiranJasvanee License: MIT Issues Forks Stars Language

NOTE: Pod version requires 1.2.0 & later

Preview

Animate your Custom 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

Things you can do, Please checkout example project to build similar.

              Animation up to custom value

KJNavigationViewAnimation

// Pass objects for appearance and disappearance of those according to scrolling.
viewKJNavigation.disappearanceObjects(instances: [labelCustomViewTitle, labelCustomViewSubtitle])    
viewKJNavigation.appearanceObjects(instances: [viewNavigation])

Requirements

  • Swift 3.0.1+
  • iOS 9.0+

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 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 Custom View, don't add identifier to it, library will detect height automatically.


Properties

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

// declare instance of KJNavigationViewAnimation by connecting it to UIView outlet in interface builder
@IBOutlet weak var viewKJNavigation: KJNavigationViewAnimation!
override func viewDidLoad() {
        super.viewDidLoad()
        
        // For TableView
        viewKJNavigation.setupFor(Tableview: yourTableView,
                                  viewController: self)
        // Animate 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)
// Animate up to zero.
viewKJNavigation.topbarMinimumSpace = .none
// Animate up to custom property.
viewKJNavigation.topbarMinimumSpace = .custom(height: 64)

#### 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

Skype: kiranjasvanee Kiran Jasvanee, kiran.jasvanee@yahoo.com

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100