我试图将地图放置在另一个视图下,以便可以通过向上滚动视图来显示它。这个 gif 应该展示:
此实现是通过实际内容下方的间隔符完成的:
var body: some View {
ZStack {
//i want to tap this view...
BackgroundMapCONTENTVIEW()
.onTapGesture {
print("i wish i could be tapped")
}
//...but this ScrollView is getting all the user input
GeometryReader { proxy in
ScrollView {
ZStack {
Rectangle()
.accentColor(Color.white)
.foregroundColor(Color.white)
.frame(width: proxy.size.width, height: proxy.size.height, alignment: .top)
.allowsHitTesting(false)
CompassCONTENTVIEW()
.frame(width: proxy.size.width, height: proxy.size.height, alignment: .top)
}
Spacer()
.frame(height: 450.0)
.opacity(0.0)
.disabled(true)
.allowsHitTesting(false)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我尝试了 .allowsHitTesting(false) 和 .disabled(true)。但 ScrollView 当前正在获取所有触摸事件。我该怎么办?
归档时间: |
|
查看次数: |
807 次 |
最近记录: |