Last updated 4 years ago
Was this helpful?
Form相较于List更适合用于类似设置页面这样的场景 下面的图和代码可以直观感受一下
Form
List
想要修改Form的背景色,第一反应会这样写:
Form { Section { Text("VIP") } Section { Text("Coin") } } .background(Color.red) .scaledToFill()
实际上Form是基于TableView的。 这里需要进行以下操作:
TableView
init() { UITableView.appearance().backgroundColor = .clear }
依旧需要通过UITableView实现,可见现在SwiftUI完成度还不高。 总是通过使用UIKit来进行一些常用属性的设置。
UITableView
SwiftUI
UIKit
init() { UITableView.appearance().showsVerticalScrollIndicator = false }
然鹅并没有效果