1

For example we have UIPickerView with 2 items: 'Item1', 'Item2'. User selected 'Item1'. This method is called

   public func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {}

But when user again selected that item 'Item1' then that method is not called.

Question: how to define that selected item ('Item1') was selected again on UIPickerView?

Kiryl Ivanou
  • 1,015
  • 2
  • 12
  • 22

1 Answers1

0

The method titleForRow only gets called to initialize titles/strings for the pickerView. I think you're looking for this method which gets called when user selects a row.

func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {

}

Mochi
  • 1,059
  • 11
  • 26
  • thanks for reply, Mochi. but didSelectRow is also not called if i select before selected item. so if i select Item1. it is called. again select Item1 it is not called. it will be called again if i select Item2 – Kiryl Ivanou Mar 10 '17 at 21:50
  • Okay, so you want the function called when item1 is selected again? Well.. just to clear things up, what do you want to happen when each item is selected? – Mochi Mar 10 '17 at 22:03
  • Thank you, Mochi, for trying to help! User agscastaneda found the solution in the comment below my question. – Kiryl Ivanou Mar 10 '17 at 22:15