Skip to content

A single class to control and persist a fixed position of a header view when scrolling through a UITableView.

License

Notifications You must be signed in to change notification settings

bobek-balinek/uitableview-sticky-header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

uitableview-sticky-header

A single class to control and persist a fixed position of a header view when scrolling through a UITableView.

Usage

class ViewController: UITableViewController {

    @IBOutlet var myHeaderView: UIView!

    var stickyHeaderController: StickyHeaderController!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Set up sticky header view
        stickyHeaderController = StickyHeaderController(view: myHeaderView, height: 300)
        stickyHeaderController.attach(to: self)
    }

    override func scrollViewDidScroll(_ scrollView: UIScrollView) {
        super.scrollViewDidScroll(scrollView)

        // Update the layout of the header view
        stickyHeaderController.layoutStickyView()
    }
}

About

A single class to control and persist a fixed position of a header view when scrolling through a UITableView.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages