I'm trying to create a sliding menu (kind of like in Facebook/Twitter apps) and my version successfully uses pan gestures for this effect. The class is called "SlideMenu".
I'm instantiating a SlideMenu in my ViewController, and then adding a bunch of UI elements as subviews on it, such as UISliders, UIButtons, etc.
The issue is that the pan gesture seems to interfere with the UISlider, as it will slide, but stop after a very short distance. I found a piece of code on an answer (Gesture problem: UISwipeGestureRecognizer + UISlider) however I am unsure on how to implement it or if it works with my design.
The code is this:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isKindOfClass:[UISlider class]]) {
// prevent recognizing touches on the slider
return NO;
}
return YES;
}
I tried adding it to my SliderMenu class and my ViewController, but no dice. Where does this go? What delegate do I have to set (if any?) Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…