I am trying to perform an action (removing a subview) every time the side menus are closed. But I want this action to be performed before resetTopViewAnimated starts.
I only have the TapGesture (no slide) configured on my ECSlidingViewController.
Is there any way to do this?
After some more testing and reading, I was able to understand the Custom Gestures when using ECSlidingViewController.
It's quite simple actually!
Create your custom gesture:
- (UITapGestureRecognizer *)localTapGesture {
if (_localTapGesture) return _localTapGesture;
_localTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(customResetTopView)];
return _localTapGesture;
}
When instantiating your slidingViewController, set the topViewAnchoredGesture to use a Custom Gesture:
self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGestureCustom;
Then just add the Gesture Recognizer you created as one of the customAnchoredGestures:
self.slidingViewController.customAnchoredGestures = @[self.localTapGesture];