Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

454
Views
Cómo agregar más relleno debajo de TextView cuando se muestra el teclado

Cuando tengo TextField dentro de ScrollView y lo toco, el teclado se muestra como se esperaba. Pero parece que TextField se movió lo suficiente para mostrar el área de entrada, pero quiero que se mueva lo suficiente para que sea visible en su totalidad. De lo contrario, parece recortado. No pude encontrar una manera de cambiar este comportamiento.

 struct ContentView: View { @State var text:String = "" var body: some View { ScrollView { VStack(spacing: 10) { ForEach(1...12, id: \.self) { Text("\($0)…") .frame(height:50) } TextField("Label..", text: self.$text) .padding(10) .background(.white) .cornerRadius(10) .overlay( RoundedRectangle(cornerRadius: 10) .stroke(.blue, lineWidth: 1) ) } .padding() .background(.red) } } }

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Use un modificador .safeAreaInset.

 @State var text:String = "" var body: some View { ScrollView { VStack(spacing: 10) { ForEach(1...12, id: \.self) { Text("\($0)…") .frame(height:50) } TextField("Label..", text: self.$text) .padding(10) .background(.white) .cornerRadius(10) .overlay( RoundedRectangle(cornerRadius: 10) .stroke(.blue, lineWidth: 1) ) } .padding() .background(.red) }.safeAreaInset(edge: .bottom) { //this will push the view when the keyboad is shown Color.clear.frame(height: 30) } }
over 4 years ago · Santiago Trujillo Report

0

Puede proporcionar padding adicional a la vista (y funciona incluso en iOS 13 y 14):

 struct ContentView: View { @State var text:String = "" var body: some View { ScrollView { VStack(spacing: 10) { ForEach(1...12, id: \.self) { Text("\($0)…") .frame(height:50) } TextField("Label..", text: self.$text) .padding(10) .background(.white) .cornerRadius(10) .overlay( RoundedRectangle(cornerRadius: 10) .stroke(.blue, lineWidth: 1) ) .padding(.bottom, 32) //here, set as much pasding as you want } .padding() .background(.red) } } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!