Swiftui 快捷键问题:将文本放在列表视图的下方(外部)
我正在尝试将此信息放在我的列表下面。我不希望它包含在列表中,而是应该显示在视图背景上。有点像iOS 6中的旧设置。我试着把我的代码片段放在不同的地方,删除堆栈,甚至改变我正在使用的堆栈,但我想不出来。这是我的代码,我附上了一个截图供参考。谢谢所有能帮助我的人 我的代码:Swiftui 快捷键问题:将文本放在列表视图的下方(外部),swiftui,swiftui-list,Swiftui,Swiftui List,我正在尝试将此信息放在我的列表下面。我不希望它包含在列表中,而是应该显示在视图背景上。有点像iOS 6中的旧设置。我试着把我的代码片段放在不同的地方,删除堆栈,甚至改变我正在使用的堆栈,但我想不出来。这是我的代码,我附上了一个截图供参考。谢谢所有能帮助我的人 我的代码: import SwiftUI struct SettingsAboutView: View { var body: some View { List{ //Top Sec
import SwiftUI
struct SettingsAboutView: View {
var body: some View {
List{
//Top Section
Section {
HStack(spacing: 30) {
Spacer()
ZStack {
Rectangle()
.frame(width: 50, height: 50)
.clipShape(Rectangle())
.shadow(radius: 2)
.foregroundColor(Color("PineGlade"))
Image(systemName: "leaf.arrow.circlepath")
.resizable()
.frame(width: 25, height: 25)
.clipShape(Rectangle())
.foregroundColor(.white)
}.cornerRadius(10)
VStack(alignment: .leading) {
Text("Gardn")
.font(.system(size: 32))
.fontWeight(.bold)
.foregroundColor(Color("ShipsOfficer"))
Text("OnlyOdds.co Labs")
.font(.system(size: 13))
.fontWeight(.medium)
.foregroundColor(Color("ShipsOfficer"))
}
Spacer()
}.padding()
NavigationLink(destination: SettingsPrivacyView()) {
Button(action: {
print("Privacy Settings")
}) {
SettingsCell(title: "Privacy", imgName: "eye.slash", clr: Color("PineGlade"))
}
}
NavigationLink(destination: SettingsNotificationsView()) {
Button(action: {
print("Notification Settings")
}) {
SettingsCell(title: "Notifications", imgName: "bell", clr: Color("PineGlade"))
}
}
}
//Technical Info
HStack(spacing: 62) {
Spacer()
Text("V \(UIApplication.appVersion!)")
.font(.system(size: 14))
.fontWeight(.light)
.foregroundColor(Color("ShipsOfficer"))
.opacity(0.5)
Text("Build \(UIApplication.appBuild!)")
.font(.system(size: 14))
.fontWeight(.light)
.foregroundColor(Color("ShipsOfficer"))
.opacity(0.5)
Spacer()
}
}.listStyle(GroupedListStyle())
.environment(\.horizontalSizeClass, .regular)
.navigationBarTitle("Settings", displayMode: .inline)
}
}
struct SettingsAboutView_Previews: PreviewProvider {
static var previews: some View {
SettingsAboutView()
}
}
extension UIApplication {
static var appVersion: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
}
}
extension UIApplication {
static var appBuild: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
}
}
把清单放在一个VStack里 文本(你的文本)
在列表下,您要查找的是页脚。将页脚作为ViewBuilder作为参数
Section(footer: Text("Your footer text")) {
//Your Content here
}
您可以传递
Text()
或创建自己的自定义视图 您是否尝试过将版本单元格的背景色更改为不存在的颜色?我尝试过,但我的导航栏标题不断出错谢谢!这就是我需要的!“我知道这很简单,但我想不出来。”PoonDopolis说,“没问题。也必须阅读他们的文档,只在旧的Objective C时代知道它,从未在SwiftUI中查找过它。