3D-Touch弹出ContextMenu菜单
3个月前 • 125次点击 • 来自 SwiftUI
备忘一下如何使用3D-Touch弹出ContextMenu菜单:
struct ContentView: View {
var body: some View {
Text("Options")
.contextMenu {
Button(action: {
// change country setting
}) {
Text("Choose Country")
Image(systemName: "globe")
}
Button(action: {
// enable geolocation
}) {
Text("Detect Location")
Image(systemName: "location.circle")
}
}
}
}
标签