无点击事件即可取消呈现的视图
我正在使用Swiftui中的一个应用程序。我使用
.sheet(isPresented: $doIWantThisViewToShowUser, content: {
DraggedUsersMenu()
})
draggedusersmenu()
是我想展示的视图。在这里,我需要从中导航到另一个ContentView。现在,导航完美地工作了我的第二个屏幕,但它的背后是呈现的视图。 一旦我们导航到另一个控制器,是否有一种方法可以自动忽略()此视图。
I am working with an app in SwiftUI.I have presented one view using
.sheet(isPresented: $doIWantThisViewToShowUser, content: {
DraggedUsersMenu()
})
DraggedUsersMenu()
is view I wanted to present. Here I have few stacks from which I need to navigate to another contentView. Now navigation Works perfectly My 2nd screen is there,but its behind this presented View.
Is there a way to dismiss() this view automatically, once we navigate to another controller.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加此:
@environment(\。presentationMode)var PresentationMode
。当您想解散使用时:
presentationMode.wrappedvalue.dismiss()
Add this:
@Environment(\.presentationMode) var presentationMode
.And when you want to dismiss use:
presentationMode.wrappedValue.dismiss()