I have the following code in viewDidLoad on a UIViewController:
UIScreenEdgePanGestureRecognizer *edgeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleRightEdgeSwipe:)]; edgeRecognizer.edges = UIRectEdgeRight; [self.view addGestureRecognizer:edgeRecognizer];
and the goal is to trigger a slide show when a right edge gesture is detected.
-(void)handleRightEdgeSwipe:(UIGestureRecognizer*)sender { NSLog(@"Showing Side Bar"); [self presentPanelViewController:_lightPanelViewController withDirection:MCPanelAnimationDirectionRight]; }
But I see that the handleRightEdgeSwipe function is run several times - sometimes 5 times, which makes the sidebar view, which should smoothly animate the slide in Flash several times.
(NOTE: I tried to start the view from UIButton and it works fine).
Why is the right edge gesture triggered several times and how can I fix it?
ios objective-c uigesturerecognizer
motionpotion
source share