by Anonymous » 07 Apr 2025, 05:44
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.>
Ich habe ein Problem beim Hinzufügen eines Randes für meine Textfelder in Swiftui. [url=viewtopic.php?t=14917]Ich möchte[/url] 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]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)
[/code]
Ich habe versucht, einen Rand hinzuzufügen, um einen Rand zu erhöhen.>