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

for loop in titleForRow in pickerView not working

$
0
0

I was creating a clock pickerView and used the following:

var countSec = Array(0...10)
var countMin = Array(0...59)
var countHour = Array(0...59)

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
    if component == 0{
        for count in countSec {
            return "\(count)"
        }
    }else{
        for count in countMin{
            return "\(count)"
        }
    }
    return nil
}

But when I run, all the data was 0s.


Viewing all articles
Browse latest Browse all 592

Trending Articles



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