【发布时间】:2019-09-15 20:06:12
【问题描述】:
我的代码中有 2 个视图,一个 VStack,然后是一个自定义视图。
我正在为 -75 的第二个视图添加偏移量,以将其移动到第一个视图的顶部。
这是我当前的代码:
Group {
VStack {
//First View
VStack {
Image("LogoCrest")
NavigationLink(destination: LocationSearch()) {
Text("Find a location")
.foregroundColor(Color.white)
.bold()
.padding()
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.center)
.background(Color(red: 81 / 255, green: 175 / 255, blue: 67 / 255))
.cornerRadius(7)
.padding()
}
.padding(.top, 75)
.padding(.bottom, 75)
.frame(minWidth: 0, maxWidth: .infinity, alignment: Alignment.center)
.background(Color(red: 49 / 255, green: 49 / 255, blue: 49 / 255))
//Second view
CircuitList(Circuits: Circuits)
.offset(y: -75)
.padding()
}
}
.background(Color(red: 232 / 255, green: 232 / 255, blue: 232 / 255))
.edgesIgnoringSafeArea(.top)
如何增加第二个视图的高度,使其始终位于底部(请参阅下图中的黑线以获得所需的额外高度)?
【问题讨论】:
标签: swiftui