0

I've been having difficulty in determining when a UIPickerView has started scrolling.

Having tried various methods proposed in different answers, it appears that none of them work in iOS7.

I have tried using the UITapGestureRecognizer but the PickerView will not handle it, however Swipe and Long Press gestures are working fine.

The following is working but I really want to get a TapGesture to work instead

pickerView.AddGestureRecognizer(new UILongPressGestureRecognizer(lp => 
        {
            PickerValueChanged = false;
        })
        {
            MinimumPressDuration = 0.1,
            CancelsTouchesInView = false,
            NumberOfTouchesRequired = 1
        });

Any ideas would be greatly appreciated

adnan
  • 141
  • 2
  • 12

1 Answers1

1

Managed to solve my issue by using the following code

pickerView.AddGestureRecognizer(new UITapGestureRecognizer(tap =>
            {
                DisableButton();
                Console.WriteLine("tapped");
            })
            {
                CancelsTouchesInView = false,
                NumberOfTouchesRequired = 1,
                ShouldRecognizeSimultaneously = delegate { return true; }
            });

I disable the Button once the picker starts scrolling and then in pickerDataModel_ValueChanged event I am enabling the button again.

adnan
  • 141
  • 2
  • 12
  • Saved me a lot of time! Thankyou. For reference this [link](http://stackoverflow.com/questions/22319427/ios-7-1-uitapgesture-not-working-with-uipickerview) also helps, I had trouble transcribing the objC (delegate { return true;) – Thedood Jan 28 '15 at 23:33