AutoToggleHeaderFooterView

A header and footer toggle display-state depending on the scroll or time interval

Showing:

Popularity

Downloads/wk

0

GitHub Stars

86

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

License

Apache License, Version 2.0

Categories

Readme

AutoToggleHeaderFooterView

Version License Platform

A view which can control the behavior of the header and footer depending on the conditions like

  • the distance a user scrolls the view over
  • the duration a user do no action for

Requirements

  • iOS 8.0+
  • Swift 3.0.2

Gif

movie

Try Demo

You can try Demo app quickly.

$ pod try 'AutoToggleHeaderFooterView'

Usage

Require

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()

    // If scrollview under the translucent NavigationBar, use this.
    autoToggleView.register(scrollView: tableView)
}


// UIScrollViewDelegate

func scrollViewShouldScrollToTop(_ scrollView: UIScrollView) -> Bool {
    autoToggleView.showHeaderFooter(withDuration: 0.3)
    return true
}

TableView Example

override func viewDidLoad() {
    super.viewDidLoad()

    // Initialize with any header or footer
    let autoToggleView = AutoToggleHeaderFooterView(header: header, footer: footer)
    autoToggleView.addScrollView(tableView)

    // Add to any view
    view.addSubview(autoToggleView)

    // If scrollview under the translucent NavigationBar, use this.
    // And call `AutoToggleHeaderFooterView.register(scrollView:) at `viewDidLayoutSubviews`.
    autoToggleView.makeEdgesEqualToSuperview()

    // Or not under the NavigationBar
//    automaticallyAdjustsScrollViewInsets = false
//    makeEdgesFitToLayoutGuide(view: autoToggleView)
}

WebView Example

override func viewDidLoad() {
    super.viewDidLoad()

    let autoToggleView = AutoToggleHeaderFooterView(header: header, footer: footer)
    autoToggleView.addSubview(self.webView)
    autoToggleView.register(scrollView: self.webView.scrollView)

    automaticallyAdjustsScrollViewInsets = false

    view.addSubview(autoToggleView)
    makeEdgesFitToLayoutGuide(view: autoToggleView)

    webView.makeEdgesEqualToSuperview()
    webView.load(URLRequest(url: URL(string: "https://www.recruit-lifestyle.co.jp/")!))
}

Change options

public var isTimerEnabled = true
public var isScrollHeaderFooterEnabled = true
public var showAnimationDuration = TimeInterval(0.5)
public var autoShowTimeInterval = TimeInterval(3.0)

Installation

AutoToggleHeaderFooterView is available through CocoaPods or Carthage.

CocoaPods

pod "AutoToggleHeaderFooterView"

Carthage

github "recruit-lifestyle/AutoToggleHeaderFooterView"

Credits

AutoToggleHeaderFooterView is owned and maintained by RECRUIT LIFESTYLE CO., LTD.

AutoToggleHeaderFooterView was originally created by Tomoya Hayakawa

License

Copyright 2017 RECRUIT LIFESTYLE CO., LTD.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

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