且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Swift:如何在 Swift 中使用三个组件设置 UIPickerView 的默认值?

更新时间:2022-04-25 01:15:15

这是我在我的一个应用程序中使用的代码:

This is the code I have used in one of my apps:

// Declare the outlet to the picker in your storyboard
@IBOutlet var myPicker: UIPickerView!

//...

override func viewDidLoad() {
//...
    myPicker.selectRow(row, inComponent: 0, animated: true)
}

显然,将 row0 替换为您想要的任何值.

Obviously, replace row and 0 with whatever values you want.

希望这有帮助!