Search code examples
iosobjective-cios7ecslidingviewcontroller

ECSlidingViewController - How do you know when the menu has been shown?


I am integrating [ECSlidingViewController], which I found on github, in my app and I want to know if there is a property which tells me if the menu has been shown or not. I will be using this to control the functionality of the menu button, as a toggle to hide and show the menu. Is there any such property?


Solution

  • Had the same issue, i'm sure there is a better way but I just did:

    - (IBAction)revealMenu:(id)sender
    {
        ECSlidingViewController *slidingViewController = self.slidingViewController;
        if (slidingViewController.currentTopViewPosition == ECSlidingViewControllerTopViewPositionAnchoredRight) {
            [slidingViewController resetTopViewAnimated:YES];
        } else {
            [slidingViewController anchorTopViewToRightAnimated:YES];
        }
    }