Wie verändere ich die Farbe von Grenze für Textfield in Swiftui?IOS

Programmierung für iOS
Anonymous
 Wie verändere ich die Farbe von Grenze für Textfield in Swiftui?

Post by Anonymous »

Ich habe ein Problem beim Hinzufügen eines Randes für meine Textfelder in Swiftui. Ich möchte einen roten Rand erstellen, wenn der Benutzer auf die Schaltfläche klickt. Ich verstehe jedoch nicht, wie ich es mit TextFieldStyle (.Roundborder) richtig erstellen kann. Suchen Sie nach Ihrer Hilfe

Code: Select all

struct CreateAccountViewController: View {
var body: some View {
Text("Don't have an account?")

}
}

struct FirstViewController: View {
@Environment(\.managedObjectContext) private var viewContext
@State private var emailAddress: String = ""
@State private var emailPassword: String = ""
@State private var isButtonClicked: Bool = false
@State var path = NavigationPath()

var body: some View {
NavigationStack(path: $path) {
VStack {
TextField("Email", text: $emailAddress)
.textFieldStyle(.roundedBorder)
.font(.headline)
.padding(.horizontal, 25)
.autocorrectionDisabled()
.textInputAutocapitalization(.never)

SecureField("Password", text: $emailPassword)
.textFieldStyle(.roundedBorder)
.font(.headline)
.padding(.horizontal, 25)
.padding(.top, 15)
.autocorrectionDisabled()
.textInputAutocapitalization(.never)

Text("The following text fields should be filled.")
.fontWeight(.bold)
.foregroundColor(Color.red)
.opacity(isButtonClicked ? 1 : 0)
.padding(.top, 15)

Ich habe versucht, einen Rand hinzuzufügen, um einen Rand zu erhöhen.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post