Skip to content

kagmanoj25/TopHeaderViewHideShow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

MJHeaderViewHideShow

License: MIT Issues Forks Stars Language

Preview

Scroll to hide/show custom header view using TableView OR ScrollView.

Requirements

  • Xcode 9.0+
  • iOS 10+
  • Swift 4.0+

Installation

Usage

MJHeaderViewHideShow will be used via interface builder.

  • Add Custom View (UIView) at the top in your interface builder. Add MJHeaderAnimation 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 viewTop: MJHeaderAnimation!
override func viewDidLoad() {
    super.viewDidLoad()
    // Hide default NavigationBar
    self.navigationController?.isNavigationBarHidden = true
    //Parameter details
    // 1. UITableView instance
    // 2. Title Optional with ""
    // 3. Minimum header view hieght
    self.viewTop.initializationTopViewSettings(self.tblView, "Manoj", 44)
}

Methods

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

extension ViewController: UIScrollViewDelegate {
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
       // MJHeaderView is my declared MJHeaderViewHideShow property in ViewController class
        viewTop.scrollViewDidScroll(scrollView)
    }
    
    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        viewTop.scrollViewDidEndDecelerating(scrollView)
    }
    
    func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
        viewTop.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
    }
}

Author

Manoj Kag

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages