【发布时间】:2020-06-19 10:47:39
【问题描述】:
ScrollView 和 VStack 内部有四个水平堆栈 (HStack)。我在每个水平堆栈 (HStack) 中有一对 ZStack 东西。以下是我的代码。
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
ScrollView {
VStack(spacing: 0) {
HStack(spacing: 0) {
ZStack {
Rectangle().frame(width: UIScreen.screenWidth / 2.0, height: UIScreen.screenWidth / 2.0, alignment: .topLeading)
.foregroundColor(.orange)
.border(Color.yellow, width: 2)
NavigationLink(destination: AliceView()) {
Text("Alice")
.foregroundColor(Color.black)
.font(.largeTitle)
}
}
ZStack {
Rectangle().frame(width: UIScreen.screenWidth / 2.0, height: UIScreen.screenWidth / 2.0, alignment: .topLeading)
.foregroundColor(.orange)
.border(Color.yellow, width: 2)
NavigationLink(destination: KimView()) {
Text("Kim")
.foregroundColor(Color.black)
.font(.largeTitle)
}
}
}
HStack(spacing: 0) {
...
...
...
}
HStack(spacing: 0) {
...
...
...
}
HStack(spacing: 0) {
...
...
...
}
}
}
.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)
.navigationBarTitle("")
}
}
}
当我滚动到顶部时,屏幕顶部没有显示任何内容。但是当我滚动到底部时,会出现一个看起来像导航控制器的水平条。如何阻止看起来像导航控件的水平条出现?谢谢。
【问题讨论】:
标签: ios swiftui scrollview vstack hstack