mercredi 3 septembre 2014

How can i Cancel the UIPickerView scrolling gesture once UILongPressGestureRecognizer begins without lifting a finger?


Vote count:

0




Here is my situation. I have a UIPickerView that i am using to select times (hrs, mins, secs). I have a long press gesture setup on the picker so that when i hold my finger down for one second an action sheet will pop up to save the values as a preset. However, the picker will register as if i am dragging the scroll wheels up and down during the long press, even after the action sheet appears (triggered by the long press). This is leading to the picker wheels being able to be moved after the action sheet pops up and the values may accidentally change if the user doesn't lift their finger fast enough.


I have tried:



- (IBAction)pickerLongPressDetected:(UILongPressGestureRecognizer *)sender{

if (sender.state == UIGestureRecognizerStateBegan)
{
self.picker.userInteractionEnabled = NO;
self.picker.userInteractionEnabled = YES;
}
}


but this doesn't work. I have tried looping through all the gesture recognizers of the view and canceling them but that doesn't work either because there is no visible property for the picker's built in gesture recognizer.


I have searched far and wide for a solution and cannot find one. Is there a way to directly access the picker gesture property and try to cancel it, or add something to where the action sheet loads and pops up to cancel all current touches?


Any help will be greatly appreciated. Thanks.



asked 1 min ago







How can i Cancel the UIPickerView scrolling gesture once UILongPressGestureRecognizer begins without lifting a finger?

Aucun commentaire:

Enregistrer un commentaire