3

i have a problem and read so many Solutions here on Stack but nothing really worked. I have an Form View with different sections, TextFields and at the end one Texteditor. When i click the Texteditor the Editor in the Form should go up over the Keyboard.

My Code:

var body: some View {
        NavigationView{
            VStack{
            Form{
                Section{TextField}
                Section{TextField}
             
                Section{
                    ZStack{
                        TextEditor
                    }
                }
                Section{
                    ZStack{
                    TextEditor(text: $info)
                        .ignoresSafeArea(.keyboard)
                    Text(info).opacity(0).padding(.all, 8)
                    }
                }
            }
            .frame(alignment: .top)
            .navigationBarItems(leading: Button(action: {
                self.addUser = false
                
            }, label: {
                Image(systemName: "chevron.backward")
            }))
        }.onTapGesture {
            UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
        }
       }.navigationBarTitle("Kunden Hinzufügen", displayMode: .inline)
}
}

enter image description here

3
  • 1
    Does this answer your question? iOS 14 SwiftUI Keyboard lifts view automatically Commented Dec 19, 2020 at 21:50
  • Hey, no this doesn't work for me the TextEditor and the whole View is still not moving up. Commented Dec 20, 2020 at 1:28
  • Hi @HogirAkan, did you manage to solve this problem? Commented Apr 11, 2022 at 8:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.