SwiftUI Navigation on iPad - How to show master list

后端 未结 3 1014
误落风尘
误落风尘 2020-12-31 01:31

My app has simple navigation needs

  • List View (parent objects)
  • List View (child objects)
  • Detail View (child object)

I have this

3条回答
  •  情深已故
    2020-12-31 02:04

    in iOS 13.4, a "back to master view" button has been added to the iPad layout. From the release notes:

    When using a NavigationView with multiple columns, the navigation bar now shows a control to toggle the columns. (49074511)

    For example:

    struct MyNavView: View {
        var body: some View {
            NavigationView {
                NavigationLink(
                    destination: Text("navigated"), 
                    label: {Text("Go somwhere")}
                )
                .navigationBarTitle("Pick Item")
            }
        }
    }
    

    Has the following result:

提交回复
热议问题