1

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?

Rameez Hussain
  • 6,414
  • 10
  • 56
  • 85
  • I set up a function which returns a "menuShown" BOOL based on the current frame of the topViewController's view. So I got it to work. Couldn't find anything in the documentation though. – Rameez Hussain Dec 29 '13 at 22:45
  • 1
    Yeah. I looked through the source quickly, and saw no such property. Frankly I'm surprised the developer of ECSlidingViewController left such a thing out the project. But whatever, glad you found a workaround. :) – Josiah Dec 29 '13 at 22:50

2 Answers2

6

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];
    }
}
JMWhittaker
  • 3,633
  • 3
  • 23
  • 30
  • This seems to be the right method, based on the provided documentation, though mine works too even though its a workaround. I will accept this as the right answer. Thanks. :) – Rameez Hussain Dec 30 '13 at 20:27
0

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.

sigabrt
  • 1,047
  • 8
  • 11