小编d0t*_*b0t的帖子

选择器标签更改为选定值 SwiftUI

我想要一个恒定的标签,但我的选择器标签会根据我选择的值而变化

我想要一个恒定的标签,但我的选择器标签会根据我选择的值而变化。

我的代码:

Picker(
                        selection : $textBoxes[currentIndex].textFont,
                        label : Text("Font"),
                        content : {
                            Text("LuxuriousRoman-Regular").tag("LuxuriousRoman-Regular")
                            Text("Merriweather-Regular").tag("Merriweather-Regular")
                            Text("Neonderthaw-Regular").tag("Neonderthaw-Regular")
                            Text("OpenSansCondensed-Light").tag("OpenSansCondensed-Light")
                            Text("Pacifico").tag("Pacifico")
                            Text("PTSans-Regular").tag("PTSans-Regular")
                            Text("RobotoMono-VariableFont_wght").tag("RobotoMono-VariableFont_wght")
                            Text("SedgwickAve-Regular").tag("SedgwickAve-Regular")
                        }
                    ).pickerStyle(MenuPickerStyle())
Run Code Online (Sandbox Code Playgroud)

picker ios swift swiftui

2
推荐指数
1
解决办法
1855
查看次数

标签 统计

ios ×1

picker ×1

swift ×1

swiftui ×1