Does UIPickerView's selectRow:inComponent:animated: call pickerView:didSelectRow:inComponent:?

前端 未结 3 863
南笙
南笙 2021-01-04 05:19

Does UIPickerView\'s selectRow:inComponent:animated: call pickerView:didSelectRow:inComponent:? Otherwise, can I just call it myself?

Thank

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 06:14

    It does not call delegate method with swift too, but you can do it manually also. Decision for swift 3 and swift 4:

    self.pickerView.datasource = self
    self.pickerView.delegate = self
    
    self.pickerView.selectRow(0, inComponent: 0, animated: false)
    self.pickerView.delegate?.pickerView?(self.pickerView, didSelectRow: 0, inComponent: 0)
    

提交回复
热议问题