我希望地图始终位于底部滑块上方,只要底部滑块向上移动,地图就会随之移动并始终保持在其上方。
这是我的代码,顺便说一句,我今天开始行动迅速
var body: some View {
ZStack(alignment: Alignment.top) {
MapView()
// From here I want the MapView which is google maps above the SlideOverCard
SlideOverCard {
VStack {
Text("Whatever")
.font(.headline)
}.frame(width: 1000)
}
}
.edgesIgnoringSafeArea(.vertical)
}
答案 0 :(得分:1)
您可以在.zIndex
中给ZStack
或更改视图顺序(最新的将是最高的)
A)
ZStack(alignment: Alignment.top) {
MapView().zIndex(1) // by default all views has 0
SlideOverCard {
B)
ZStack(alignment: Alignment.top) {
SlideOverCard {
// ... other code here
}
MapView() // will be above
}