我尝试在我的PickerView中选择一行,但它不起作用.它停留在第一排.
这是我的代码:
@IBOutlet weak var pickerView: UIDatePicker! func numberOfComponentsInPickerView(pickerView: UIPickerView!) -> Int { return 1 } func pickerView(pickerView: UIPickerView!,numberOfRowsInComponent component: Int) -> Int { return 10 } func pickerView(pickerView: UIPickerView!,titleForRow row: Int,forComponent component: Int) -> String!{ return String(row + 1) } //In viewDidLoad pickerView.selectRow(6,inComponent: 0,animated: true)
pickerView运行良好,显示1到10但selectRow不起作用.
它应该选择第六行,但它保留在第一行.