Search code examples
iphoneobjective-ciosipaduipickerview

How to get the event when a picker view stopped scrolling


I need to perform some code when the user stop scrolling the picker, in other way, when the picker stop scrolling. The logic i want to follow is, once the picker stop scrolling, i get the current value and i do some database queries basing on that value.

In the picker view documentation, i don't see a delegate method that can help on such task. Any thoughts? thanx in advance.


Solution

  • whenever you scroll the picker view, didSelect delegate method call at the end of scroll

    - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    
    NSLog(@"Selected  %i. ",  row);
    /// do it here your queries
    }
    

    try with above example and check your console