我有一个
NavigationVeiw
它有一个
ToolbarItem
在导航栏的后面。
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
}
}
navigationBarItems(leading:trailing:)
toolbar(content:)
具有
navigationBarTrailing
安置。
- Apple
我在按钮上使用了contextMenu。
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
.contextMenu(menuItems: {
Text("Menu Item 1")
Text("Menu Item 2")
Text("Menu Item 3")
})
}
}
不敏感。你得使劲把它呈现出来。我需要提供一个像iOS照片应用程序的添加按钮的单点触控。它只需轻轻一触。
如何用一次触摸(不按)显示菜单?