Swiftui - Добавьте меню в навигационную Bartrailing's ToolbaritemIOS

Программируем под IOS
Anonymous
Swiftui - Добавьте меню в навигационную Bartrailing's Toolbaritem

Сообщение Anonymous »

У меня есть navigationVeiw , который имеет инструментальный бассейн на стороне ее навигации.

Код: Выделить всё

.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
}
}
< /code>
navigationBarItems(leading:trailing:)
устарел. Поэтому я использую панель инструментов (Content :) с NavigationBartrailing размещением. - Apple < /p>

Я использовал контекстмену на кнопке. < /P>
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {}, label: {
Text("Button")
})
.contextMenu(menuItems: {
Text("Menu Item 1")
Text("Menu Item 2")
Text("Menu Item 3")
})
}
}
< /code>
It's not sensitive. You have to press hard to present it. I need to present it with a single touch like iOS Photo App's Add button. It is presented with a single touch.
How to show Menu with a single touch (not press)?

Подробнее здесь: https://stackoverflow.com/questions/652 ... oolbaritem

Вернуться в «IOS»