简体   繁体   中英

Get selected value from UIPickerView custom delegate & data source

So I cannot provide you with any code, but it's quite simple what I want to achieve. I am searching for a way to get the selected value from an UIPickerView in iOS 8 (Swift) these pickerviews have a custom delegate & data source.

So the method of didSelectRow is accessed in a custom class, not the ViewController, but I would have to be able to get the selected value and use it in the ViewController. Let's say, place it in a textbox.

I can't find a way to do this, should I try to access the delegate itself or what should I be doing?

Care to share your knowledge with the students of Application Development? :)

The UIPickerView class has a method named: `selectedRowInComponent'. This function may help you select components in a picker view. Apple Documentation for UIPickerView class would help you with your project.

Also make sure your view controller conforms to the UIPickerViewController Delegate and Data source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM