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

UIPickerView default row

$
0
0

If I want to have the default row when the view controller starts as [2] or any other row number, how do I carry that out?

var pickerData = ["2x2","4x4","6x6","8x8","12x12"]    override func viewDidLoad() {    super.viewDidLoad()    totalTilesLabel.text = pickerData[8]    display.text = sentData    self.picker.delegate = self    self.picker.dataSource = self}

This is the UIPicker datasource and delegate.

func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {    return 1}func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {    return pickerData.count}func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {    return pickerData[row]}func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {}

Viewing all articles
Browse latest Browse all 592

Trending Articles



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