Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicnocquee/header-sticky-tab
A container view controller that displays children view controllers in tabs like the profile screen on Twitter or Instagram without any dependencies
https://github.com/nicnocquee/header-sticky-tab
ios swift xcode
Last synced: 3 months ago
JSON representation
A container view controller that displays children view controllers in tabs like the profile screen on Twitter or Instagram without any dependencies
- Host: GitHub
- URL: https://github.com/nicnocquee/header-sticky-tab
- Owner: nicnocquee
- Created: 2020-06-26T04:07:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-06T15:06:25.000Z (about 2 years ago)
- Last Synced: 2024-10-02T07:58:57.823Z (3 months ago)
- Topics: ios, swift, xcode
- Language: Swift
- Homepage:
- Size: 1.18 MB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HeaderStickyTabViewController
## About
A container view controller that displays children view controllers in tabs like the profile screen on Twitter or Instagram without any dependencies. When the user scrolls the scroll view of the child view controller, the tab/segment control stick at the top.
![](https://github.com/nicnocquee/header-sticky-tab/raw/master/preview.gif)
## Features
- Custom header view
- Custom tab view## Installation
### Manual
Add the `HeaderStickyTabViewController.swift` file from `Sources/HeaderStickyTabViewController` directory to your project.
### Swift Package Manager
Add this package in Xcode: `https://github.com/nicnocquee/header-sticky-tab`
### Cocoapods
Coming soon.
## Usage
- Create a view controller that extends `HeaderStickyTabViewController`
- Assign a view to `headerView` property.
- Assign the children view controllers to `viewControllers` property.
- Override `childDidScroll` function if needed.
- Override `didChangePage` method if needed.```swift
import HeaderStickyTabViewControllerclass ProfileViewController: HeaderStickyTabViewController {
static func create() -> ProfileViewController {
let vc = ProfileViewController()
vc.title = "Child"vc.headerView = ProfileHeaderView()
vc.viewControllers = [
FirstTabViewController(style: .plain),
SecondTabViewController(style: .plain)
]return vc
}
}
```Checkout `Example/HeaderStickyTab/ProfileViewController.swift` in this repository for example.
## Example
Open `Example/HeaderStickyTab.xcworkspace`. Run the sample app in simulator. The example shows how to blur the header image when user pull down the scroll view.
## License
MIT