Latest 1.0.0
Homepage https://github.com/recruit-lifestyle/AutoToggleHeaderFooterView
License Apache License, Version 2.0
Platforms ios 8.0
Authors

Version
License
Platform

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

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.

Latest podspec

{
    "name": "AutoToggleHeaderFooterView",
    "version": "1.0.0",
    "summary": "A header and footer toggle display-state depending on the scroll or time interval",
    "homepage": "https://github.com/recruit-lifestyle/AutoToggleHeaderFooterView",
    "license": "Apache License, Version 2.0",
    "authors": {
        "Tomoya Hayakawa": "[email protected]"
    },
    "source": {
        "git": "https://github.com/recruit-lifestyle/AutoToggleHeaderFooterView.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "AutoToggleHeaderFooterView/Classes/**/*",
    "pushed_with_swift_version": "3.0.2"
}

Pin It on Pinterest

Share This