【发布时间】:2020-02-09 01:10:41
【问题描述】:
我目前无法确定如何消除内容视图 (VStack) 和标签栏视图之间的间距。有一个由 VStack 或 Tab Bar 创建的边框,我想删除它或者将间距设置为 0 以创建更流畅的外观
目前,它看起来像这样: https://i.stack.imgur.com/xbGiS.png
我的代码:
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 10) {
Button(action: {
print("Tapped!")
}) {
HStack(spacing: 10) {
Image(systemName: "clock.fill")
.foregroundColor(.white)
Text("Bus Times")
}
.padding(7.5)
.foregroundColor(.white)
.background(Color.init(red: 235/255, green: 100/255, blue: 30/255))
.cornerRadius(40)
}
Button(action: {
print("Tapped!")
}) {
HStack {
Image(systemName: "waveform.path.ecg")
Text("Services")
}
.padding(7.5)
.foregroundColor(.white)
.background(Color.init(red: 235/255, green: 100/255, blue: 30/255))
.cornerRadius(40)
}
Button(action: {
print("Tapped!")
}) {
HStack {
Image(systemName: "location.north.fill")
Text("Find me")
}
.padding(7.5)
.foregroundColor(.white)
.background(Color.init(red: 235/255, green: 100/255, blue: 30/255))
.cornerRadius(40)
}
Button(action: {
print("Tapped!")
}) {
HStack {
Image(systemName: "magnifyingglass")
Text("Search")
}
.padding(7.5)
.foregroundColor(.white)
.background(Color.init(red: 235/255, green: 100/255, blue: 30/255))
.cornerRadius(40)
}
}
}
Text("Latest news & events").font(.headline).bold()
PostRow(categoryName: "news", posts: postData)
}
.padding()
.navigationBarTitle("Royal Holloway")
.font(.subheadline)
}
【问题讨论】: