有没有一种方法可以自定义SwiftUI列表,以便从底部向顶部显示单元格?
相关问题:UITableView的处理方式为:如何从下往上填充UITableView?
struct FlipEffect: GeometryEffect {
func effectValue(size: CGSize) -> ProjectionTransform {
let t = CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: size.height)
return ProjectionTransform(t)
}
}
struct ContentView: View {
var body: some View {
List(0..<100) { item in
Text("hello, world")
.modifier(FlipEffect())
}
.modifier(FlipEffect())
}
}
List
是否具备这种能力(尚未),但显然你可以使用带有链接答案的自定义 UIViewRepresentable-View 中的 UITableView。文档 - thisIsTheFoxe