Question

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?

Was it helpful?

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];
    }
}

OTHER TIPS

I think the right approach would be to use the Anchored Top Views Gestures in order to control how the Top View behaves while it is anchored to the side.

A common solution to create a toggle for showing and hiding the menu would be:

self.slidingViewController.topViewAnchoredGesture = ECSlidingViewControllerAnchoredGesturePanning | ECSlidingViewControllerAnchoredGestureTapping;

Allowing the user to hide the menu using the Tap or the Pan gestures.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top