我尝试使用 SwiftUI 创建一个包含主标签和辅助标签的按钮的菜单,如下图所示,因此我将按钮和文本(作为辅助标签)嵌入到 VStack 中,但它不起作用。我如何在 swiftUI 中创建这个视图?
代码
Menu {
Section {
search
}
Section {
// The sort button
Menu {
Picker("Sorting options", selection: $sort) {
ForEach(SortType.allCases, id: \.self) { type in
Label("title", systemImage: "chevron.up")
.tag(type)
}
}
} label: {
// Here I should embed title and subtitle like the photo but I don't know how.
Label("Sort By", systemImage: "arrow.up.arrow.down")
}
}
} label: {
menuLabel
}
Run Code Online (Sandbox Code Playgroud) 当我尝试运行仪器核心图形测试时,我发现这样的错误"目标设备服务太旧了"