Hallo,
ich habe eine View mit mehreren Sections. Den Inhalt einer dieser Sections möchte ich gerne zentriert haben.
Es geht dabei um die Section mit dem Button "Add Picture" und dem Rating (die Katzenpfoten)
Alles anzeigen
ich habe eine View mit mehreren Sections. Den Inhalt einer dieser Sections möchte ich gerne zentriert haben.
Es geht dabei um die Section mit dem Button "Add Picture" und dem Rating (die Katzenpfoten)
Quellcode
- NavigationView
- {
- Form
- {
- Section
- {
- TextField("Name of the Creature", text: $name)
- TextField("Local Name of the Creature", text: $nameCN)
- Picker("Country", selection: $country)
- {
- ForEach(countries, id: \.self)
- {
- Text($0)
- }
- }
- .pickerStyle(WheelPickerStyle())
- }
- Section // um diese Section geht es
- {
- VStack // alignment Angaben können hinzugefügt werden bewegen sich aber nicht über die ganze Breit
- {
- Button("Add Picture")
- {
- //action
- }
- .padding()
- RatingView(rating: $rating)
- }
- }
- Section
- {
- TextEditor(text: $information)
- .padding()
- } header: {
- Text("Write down Creature information")
- }
- Section
- {
- Button("Save")
- {
- let newCreature = Kreatur(context: moc)
- newCreature.id = UUID()
- newCreature.name = name
- newCreature.nameCN = nameCN
- newCreature.country = country
- newCreature.information = information
- newCreature.rating = Int16(rating)
- //picture ...
- try? moc.save()
- dismiss()
- }
- }
- }
- .navigationTitle("Add Creature")
- }
- }
Mein Blog: https://tangculiji.de