1

I have a question about List Row Dynamic in SwiftUI; how reset height of row when EditMode of List changed, For now, ui element of Row has changed, but height of row in the list not update to fit.

inactive editmode

active editmode

anyone know how to fix it? thanks

简素开发
  • 11
  • 1
  • 3

1 Answers1

3

Use .fixedSize. Example

List {
    ForEach(users, id: \.self) { user in
        //Your list row view
          .fixedSize(horizontal: false, vertical: true) // <-- Here
    }
    .onDelete(perform: delete)
}
Raja Kishan
  • 16,767
  • 2
  • 26
  • 52