标签:方法 swift pad data- with 页面 red add cell
SwiftUI 中init方法,会在编译期进行预加载
init() {
}
// 全局生效,以项目中最后加载的init方法中的设置为准
init() {
UITableView.appearance().sectionFooterHeight = 10
UITableView.appearance().backgroundColor = UIColor.red
UITableViewCell.appearance().backgroundColor = UIColor.red
}
// 当前页面生效
.onAppear() {
UITableView.appearance().sectionFooterHeight = 10
UITableView.appearance().backgroundColor = UIColor.red
UITableViewCell.appearance().backgroundColor = UIColor.red
}
struct Footer: View {
var body: some View {
Rectangle()
.foregroundColor(.white)
.listRowInsets(EdgeInsets())
}
}
struct Timeline : View {
var body: some View {
List {
Section(footer: Footer()) {
Text("Item 1")
Text("Item 2")
Text("Item 3")
}
}
}
}
List {
Section(footer: Text(""))) {
Text("One")
Text("Two")
Text("Three")
}
}
List {
Section(footer: Text("")) {
Text("My text")
}
EmptyView()
}
List {
Text("Item 1")
Text("Item 2")
// Adding empty section with footer
Section(footer:
Rectangle()
.foregroundColor(.clear)
.background(Color(.systemBackground))){EmptyView()}
.padding(.horizontal, -15)
}
标签:方法 swift pad data- with 页面 red add cell
原文地址:https://www.cnblogs.com/liuxiaokun/p/12677018.html