Pickerview select row and didSelectRowAt functions

301 Views Asked by At

I am using picker view as a dropdown menu according to user's choice one of my text field needs to be disabled. I have added my delegate and in my didSelectRowAt function there is textField.isEnabled = false but when I tried to select row programmatically using myPicker.selectRow(0, inComponent: 0, animated: true). However when I use that function my didSelectRowAt function is not working and the text field that I need to disabled stays enabled. Why selectRow function is not triggering didSelectRowAt function and how can I trigger it?

1

There are 1 best solutions below

0
RajeshKumar R On BEST ANSWER

You can call didSelectRow method programmatically like this.

self.pickerView(self.pickerView, didSelectRow: 0, inComponent: 0)