Xcode 使用未解析标识符';演示按钮';
使用未解析标识符“PresentationButton”,是否为“PresentationButton”引入了任何新类 是否有人在代码中使用了“PresentationButton”。我想打开一个图像或内容框架点击视图Xcode 使用未解析标识符';演示按钮';,xcode,compiler-errors,swiftui,Xcode,Compiler Errors,Swiftui,使用未解析标识符“PresentationButton”,是否为“PresentationButton”引入了任何新类 是否有人在代码中使用了“PresentationButton”。我想打开一个图像或内容框架点击视图 PresentationButton(destination: ContentView()) { CourseView() } 我曾尝试在apple developer的网站上查找文档,但没有看到任何文档。PresentationButton已被弃用。如果你想展示一
PresentationButton(destination: ContentView()) {
CourseView()
}
我曾尝试在apple developer的网站上查找文档,但没有看到任何文档。PresentationButton已被弃用。如果你想展示一张工作表,请使用下面的内容
struct ModalExample: View {
@State var show = false
var detail: ModalView {
return ModalView()
}
var body: some View {
VStack {
Button("Present") {
self.show = true
}
}
.sheet(isPresented: $show, content: { ModalView() })
}
}
struct ModalView : View {
@Environment(\.presentationMode) var presentationMode
var body: some View {
VStack {
Text("Modal")
Button("Close") {
self.presentationMode.value.dismiss()
}
}
}
}
如果您没有以模式显示视图(在这种情况下,
.sheet
是最佳方式),那么在Xcode 11 beta 5中,首选的方式是使用导航链接
NavigationLink(destination: ContentView()) {
Text("show ContentView")
}