SwiftUI NavigationBar not disappearing while scrolling

前端 未结 2 813
南笙
南笙 2021-01-15 15:17

I want to hide my NavigationBar while scrolling, actually It must hide automatically but when I tried with multiple views It doesn\'t work. Also, It works when

2条回答
  •  忘掉有多难
    2021-01-15 15:49

    Based on Asperi's solution, I wanted to have the SearchBar and StatusView always visible, i.e. it should stop scrolling after the title has disappeard. You can achieve this with a section header like shown below (just a rough sketch):

    NavigationView {
        List {
            Section(header: {
                VStack {
                    SearchBar...
                    StatusView....
                }
            }) {
                ForEach...
            }
        }
    }
    

提交回复
热议问题