【发布时间】:2021-06-04 09:02:49
【问题描述】:
我想通过点击我调用它的同一个按钮或点击屏幕上的任意位置来关闭模式。
但是当弹出窗口弹出时,它不允许我与他们中的任何一个交互。可以给我一个解决方案吗?
ZStack{
Color.black.opacity(0.4)
.edgesIgnoringSafeArea(.all)
.animation(.none)
VStack{
Circle().fill(Color.orange)
.frame(width: 70, height: 70)
.overlay(Image(systemName: "questionmark.circle").font(.system(size: 50)).foregroundColor(.white
))
.offset(y: 40)
.zIndex(1)
VStack{
Color.orange.frame(height: 40)
Spacer()
Text("Let the popup open")
Spacer()
Button("Present!") {
isPresented.toggle()
}
.fullScreenCover(isPresented: $isPresented){
FullScreenModalView(showPopUP: $showPopUp)
}.padding(.vertical, 12)
.frame(maxWidth: .infinity)
.background(Color.orange)
}.background(Color.white)
.cornerRadius(12)
}.frame(height: 250)
.background(Color.clear)
.padding(.horizontal, 35)
.offset(y: 150)
.scaleEffect(x: showPopUp ? 1 : 0.8, y: showPopUp ? 1 : 1.3)
.animation(.interactiveSpring(response: 0.3, dampingFraction: 0.3), value: animate)
}.opacity(showPopUp ? 1 : 0)
【问题讨论】:
标签: swiftui modal-dialog dismiss