how to make Youtube mainView like sticky header view

48 Views Asked by At

enter image description here

In Youtube Home, when its scroll is down, youtube logo area is disappearing. When it is dragged up, the first behavior is Youtube logo area is coming down and only then the scrollview can be scrolled. How can I make it?

I tried to do by using uiView at the top and uitableView at the bottom. This is my code and it works well when I scroll one direction, But when I scroll up and down in one touch, the upper view is getting bigger than it is supposed to be.

1

There are 1 best solutions below

0
Firdavs Khaydarov On

You can achieve similar result with UINavigationController's hidesBarsOnSwipe:

import UIKit

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        navigationController?.hidesBarsOnSwipe = true
    }
}

https://developer.apple.com/documentation/uikit/uinavigationcontroller/1621883-hidesbarsonswipe