How to add right button in the navigation bar?

前端 未结 6 704
傲寒
傲寒 2021-02-05 16:40

I have a question to add a right button in navigation bar..

I have two views: View A and View B

I add a navigation bar to view A, after I used self.navigat

6条回答
  •  情歌与酒
    2021-02-05 17:22

    Try this code for Swift UI :

     .navigationBarItems(
       leading:
         HStack {
           Button("About") {
             print("About tapped!")
           }
           Button("Call") {
             print("Call tapped!")
           }
         },
                                        
       trailing:
         HStack {
           Button("Settings") {
             print("Settings tapped!")
           }
           Button("Contacts") {
             print("Contacts tapped!")
           }           
         }
      )
    

提交回复
热议问题