Search code examples
uipickerviewswift2

UIPickerView delegates not working


I have a Swift 2 SingleView app. This is the only scene in the app.

I've added two picker views to a single scene. The picker view delegate and datasource protocols have been added. I've created IBOutlets to each pickerview. The two delegate and two datasource functions are there.

When I run the app, none of the datasource or delegate functions breakpoints I've added are hit.

Is there any piece I might be missing?


Solution

  • It sounds like what you are missing is wiring up your delegate and dataSource to the UIPickerView via

    pickerView1.delegate = yourDelegate
    pickerView1.dataSource = yourDataSource
    
    pickerView2.delegate = yourDelegate
    pickerView2.dataSource = yourDataSource