Selecting first row in UIPickerView issue

两盒软妹~` 提交于 2019-12-06 10:43:24

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.

suchit kushwaha

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

textField.text = pickerArray.objectAtIndex(row).objectForKey("Name") as? String
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!