Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在UIKit中有一个UIMenu.Option .displayInline显示带有分隔符的子菜单。在 SwiftUI 中有没有办法做到这一点?
UIMenu.Option
.displayInline
您可以Menu使用Divider.
Menu
Divider
例子:
struct ContentView: View { var body: some View { Menu("Hello world!") { Button("Item 1") {} Button("Item 2") {} Divider() Button("Item 3") {} Button("Item 4") {} } } }
结果: