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

296
Views
Tengo problemas para usar el radio de esquina y los bordes en un campo de texto en SwiftUI

Tengo un campo de texto en swiftUI y, para hacerlo más atractivo, me gustaría agregar un borde y esquinas redondeadas. Pero no parece funcionar como debería (ver imagen). ¿Qué me perdí?

imagen 1

Intenté poner .cornerradius() antes de .border(), pero tuvo el mismo efecto.

 TextField("Text input goes here", text: $addMins) .padding(.all, 5.0) .background(View) .frame(width: 300.0, height: 35.0) .border(Color.green, width: 2) .cornerRadius(14)
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Entonces, ¿quieres algo como esto?

 TextField("Text Field", text: $text) .padding(4) .overlay( RoundedRectangle(cornerRadius: 14) .stroke(Color.green, lineWidth: 2) ) .padding()

campo de texto con borde verde redondeado

over 4 years ago · Santiago Trujillo Report

0

Aquí una manera simple:


ingrese la descripción de la imagen aquí


 struct ContentView: View { @State private var stringOfTextField: String = String() var body: some View { TextField("Enter text . . .", text: $stringOfTextField) .padding() .overlay(RoundedRectangle(cornerRadius: 10.0).strokeBorder(Color.black, style: StrokeStyle(lineWidth: 1.0))) .padding() } }
over 4 years ago · Santiago Trujillo Report

0

Por cierto, si necesita un campo de texto con un trazo y esquinas redondeadas con un fondo diferente, aquí tiene una solución.

 TextField("Placeholder", text: $text) .padding() .background(RoundedRectangle(cornerRadius: 5).fill(Color.gray)) .overlay( RoundedRectangle(cornerRadius: 5) .stroke(lineWidth: 1) ) .foregroundColor(.black)
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!