Latest 0.2.2
Homepage https://github.com/bchrobot/StickyHeaderTabController
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Twitter profile-inspired tabbed content controller with sticky header and hero.

Demo Gif

Example

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

Requirements

Installation

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

pod 'StickyHeaderTabController'

Usage

To get started just subclass StickyHeaderTabController and add a header! See the example project for more details.

class ExampleTabController: StickyHeaderTabController {

    private let exampleHeader = ExampleStickyHeaderView()
    private let exampleHero = ExampleStickyHeroView()
    private let exampleTabBar = ExampleTabBar(frame: .zero) // optional customization

    override func viewDidLoad() {
        super.viewDidLoad()

        delegate = self

        stickyHeader = exampleHeader
        hero = exampleHero
        tabBar = exampleTabBar
        tabs = [StatesTabViewController(), ColorsTabViewController()]
    }

    fileprivate func updateAvatarFrame() {
        // Recalculate the avatar's frame based on scroll position
    }

    fileprivate func updateNameLabel() {
        // Recalculate name label's position based on scroll position
    }

}

extension ExampleTabController: StickyHeaderTabControllerDelegate {
    func stickyHeaderTabControllerDidScrollVertically(_ controller: StickyHeaderTabController) {
        // Perform any frame updates based on changes to contentOffset
        updateAvatarFrame()
        updateNameLabel()
    }
}

StickyHeaderView

  • width is set by StickyHeaderTabController
  • height should be set by you
    • must not have priority >= 700 in order for stretch on vertical bounce to work.
    • be careful of compression resistance of subviews, especially imageviews.

StickyHeroView

  • width is set by StickyHeaderTabController
  • height should be set by you
    • must not have any priorities lower than 250.

Author

Benjamin Chrobot, [email protected]

License

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

Latest podspec

{
    "name": "StickyHeaderTabController",
    "version": "0.2.2",
    "summary": "Tabbed content controller with sticky header and hero.",
    "description": "Twitter profile-inspired tabbed content controller with sticky header and hero.",
    "homepage": "https://github.com/bchrobot/StickyHeaderTabController",
    "screenshots": "https://github.com/bchrobot/StickyHeaderTabController/raw/master/Screenshots/StickyHeaderTabController.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Benjamin Chrobot": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bchrobot/StickyHeaderTabController.git",
        "tag": "0.2.2"
    },
    "social_media_url": "https://twitter.com/bchrobot",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "StickyHeaderTabController/Classes/**/*",
    "pushed_with_swift_version": "3.2"
}

Pin It on Pinterest

Share This