[iOS] navigationBarItems 바꾸기

3874 단어 TILiOSTIL
struct ChangeName: View {
    @Binding var defaultName: String
    @State var changeprofileName: String = ""
    var body: some View {
        TextField(self.defaultName, text: $changeprofileName).modifier(ClearButton(changeprofileName: $changeprofileName))
        .navigationBarTitle("이름", displayMode: .inline)
        .navigationBarBackButtonHidden(true)
        .navigationBarItems(leading:
            HStack {
            //TODO: 닉네임을 취소로 바꾸기
                Button("취소") { }
            },trailing:
                HStack {
                    Button("저장")
                    { /*code*/ }
                }
        )
    }
}

도움된 글

**

You can create a custom back button in your navigation link by hiding native navigationBackButton. In the custom back button, you can add your translated custom back button title.

https://stackoverflow.com/a/59822675/15746954

좋은 웹페이지 즐겨찾기