UIPickerView 代表不工作

UIPickerView delegates not working

我有一个 Swift 2 SingleView 应用程序。这是应用程序中唯一的场景。

我在一个场景中添加了两个选择器视图。添加了选择器视图委托和数据源协议。我已经为每个 pickerview 创建了 IBOutlets。那里有两个委托和两个数据源函数。

当我 运行 应用程序时,none 我添加的数据源或委托函数断点被命中。

有没有我可能遗漏的部分?

听起来您缺少的是通过

delegatedataSource 连接到 UIPickerView
pickerView1.delegate = yourDelegate
pickerView1.dataSource = yourDataSource

pickerView2.delegate = yourDelegate
pickerView2.dataSource = yourDataSource