Selecting first row in UIPickerView issue

I’ve a many textfield and a pickerView with toolBar and it has a done button. My issue is I can’t select the first row from the picker. While I have debugged in the didSelectRow but it won’t run inside it. So please where would be my issue?

    func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {

    var value = currentPickerArray[row]
    textFieldOutletArray[currentTag].text = value
}

  • Making a SKScene's background transparent not working… is this a bug?
  • static const Vs extern const
  • Xcode - Weird issue with xib and auto layout (xib expands to random height)
  • iOS MKMapShapshotter completion block is not always being called
  • xcode copy files build phase - what do the destination options mean exactly?
  • How to use a UIVisualEffectView inside of a circle
  • 2 Solutions Collect From Internet About “Selecting first row in UIPickerView issue”

    Just replace didSelect method in your sample code like as bellowed. it will working fine.

    @IBAction func doneBtn(sender: AnyObject) {
    
            var row = pickerView.selectedRowInComponent(0);
            NSLog("value L %d", row)
            pickerView(pickerView, didSelectRow: row, inComponent:0)
        }
    

    Hope this help you.

    In the titleForRow function add this line of code. It shows first row selected:

    textField.text = pickerArray.objectAtIndex(row).objectForKey("Name") as? String