Quantcast
Channel: Active questions tagged uipickerview - Stack Overflow
Viewing all articles
Browse latest Browse all 592

how do I load the UIpicker on page load in swift?

$
0
0

I have two pickers and I want picker1 to be show by default when the page first loads and also when user touches the UI. I want to show in both ways for picker1.

func numberOfComponents(in pickerView: UIPickerView) -> Int {    if pickerView == picker1 {        return 1    } else {        return 2    }}func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {    var tempCount = 0    if pickerView == picker1 {        tempCount = pickerData.count    } else {    }    return tempCount}func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {    var tempPickerData = ""    if pickerView == picker1 {        tempPickerData = pickerData[row]    } else {    }    return tempPickerData}func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {    if pickerView == picker1 {        selected = pickerData[row]    } else {    }}

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>