I am trying to use multiple UIPickers on a page. I think I’ve configured almost everything. When I use a UIPicker I add in a a tool bar with a “Cancel” and a “Done” Button. I did this so that a user’s input including the very first option is always inserted into the textfield (The textfield inputView is the picker).
On the toolBar (They are all built using the same method) my DoneButton has an action called PickerDoneAction
. It looks like this:
func pickerDoneAction(sender: UIBarButtonItem){
let indexPath = picker.selectedRow(inComponent: 0)
textfield.text = data[indexPath]
}
How would I determine which UIPicker was being used when the done button was clicked, so I could then change the textfield in question and it’s data source? I tried checking if the textfield was firstResponder and even tried to check the UIPicker itself. Should I rethink my approach?