1

I want to catch the scrolling event of the UIPickerView, My app should see if the user scrolling the picker or not to cancel an another event when the user start scrolling.

deleted_user
  • 3,817
  • 1
  • 18
  • 27
Omar Freewan
  • 2,678
  • 4
  • 25
  • 49
  • [UIPickerViewDelegate Protocol Reference](http://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html) –  Oct 21 '12 at 12:31
  • yes, but it does not have the scroll delegate! – Omar Freewan Oct 21 '12 at 12:42
  • in this case, I don't believe it be public. You'll have to class-dump UIKit to find out what kind of view it uses for scrolling. –  Oct 21 '12 at 12:44
  • ok, this is what i am asking for :) – Omar Freewan Oct 21 '12 at 12:51

2 Answers2

2

This is not allowed for pickerview

Rasha Sharif
  • 189
  • 10
0

You can try and find an underlying UIScrollView instance by the following routine:

-(UIScrollView*)findUnderlyingScrollFor:(UIView*)view{
    if([view isKindOfClass:[UIScrollView class]]){
        return (UIScrollView*)view;
    }
    for(UIView* subview in view.subviews){
        if([subview isKindOfClass:[UIView class]]){
            UIScrollView* result = [self findUnderlyingScrollFor:subview];
            if(result){
                return result;
            }
        }
    }
    return nil; 
}

with the following call:

UIScrollView* scroll = [self findUnderlyingScrollFor:_pickerView];

and then become it's delegate to get all the calls you need.

if(scroll){
    scroll.delegate = self;
}
Ariel
  • 2,430
  • 1
  • 17
  • 20