Home > Net >  Swift: Hide Scrollview header
Swift: Hide Scrollview header

Time:03-18

I would like to hide the header of my scrollview.

I have a scrollview

//Contains everything inside the view
    let scrollView = UIScrollView()
    scrollView.alwaysBounceVertical = true
    scrollView.translatesAutoresizingMaskIntoConstraints = false
    scrollView.showsHorizontalScrollIndicator = false

which spans across the whole width and height of my view. When scrolling down, a weird header appears and blocks a bit of the scroll view content. I would like to hide that overlay. The worst thing is, that in bright mode, the overlay is white. That clashes with my colors. How do I go about removing it?

Header

CodePudding user response:

The overlay is the navigation bar - it appears as soon as you scroll. To hide it completely, you can set navigationController?.setNavigationBarHidden(true, animated: false). Or, you can pass in a transparent appearance for navigationController?.navigationBar.standardAppearance.

  • Related