【发布时间】:2020-07-16 12:48:35
【问题描述】:
我有一个 NavigationLink 将表单视图拉到列表视图之上。我正在经历的是当视图被拉入时发生的这种“橡皮筋”效应。我无法用作品来解释它所以here is a gif explaining it
这是一个导航视图的sn-p
NavigationView {
List {
ForEach(self.tables) { table in
NavigationLink(destination: TableStatusView(table: table)) {
tableCellView(tableNumber: table.number, clean: table.clean, inUse: table.inUse)
}
}
...
}
...
}
这是它的视图
struct TableStatusView: View {
@Environment(\.managedObjectContext) var managedObjectContext
@FetchRequest(fetchRequest: Table.getAllTables()) var tables: FetchedResults<Table>
@State var table: Table
var body: some View {
Form {
Section {
Text("Table \(table.number)")
}
Section {
Toggle(isOn: $table.inUse) {
Text("In Use")
}
Toggle (isOn: $table.clean) {
Text("Clean")
}
}
}
}
}
【问题讨论】: