Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1935
IGSideMenuView... what is it exactly?
posted

Hey guys, 

So I'm trying to make sense of the IGSideMenuView and what exactly it really is, because I need to fit it into a complex view hierarchy.

So with a simplest example, at first glance, it looked like Option A (pictured), where you'd add a side menu view as a subview of your root view controller.

However, looking at it closer and learning the API, it actually appears closer to Option B (pictured), where your root view controller actually becomes a CHILD view of the menu view, and the menu view is really a full screen view that sits behind the root view controller, and it's partitioned to a left side, and right side, and uses a gesture to slide the root view controller to the left or right, revealing the parent view controller... aka the menu view controller.

The thing that still has me really confused though is how the side views gestures are hooked up.  

How does the side view know that I'm not already using a "long press, slide" gesture on my root view controller, or one of it's subviews??

Please help me get a handle on what's really going on here.

Thanks

Dave.

Option A

Option B

Parents
No Data
Reply
  • 4940
    Offline posted

    Hi David,

    I'll try my best to explain the hierarchy and the control. The IGSideMenuView is a UIView that contains a contentView (another UIView) that will cover a configurable UIView on the left, right, or both sides of the IGSideMenuView. By default, the control uses the long press gesture to expose any configured side menus. Properties exist where the long press gesture for exposing a side menu can be disabled and use of an API call can expose the menu. This is useful for scenarios where a developer would want to use a hamburger menu.

    A simplified form of the hierarchy can be thought of like this:

    UIWindow > UIViewController > UIView > IGSideMenuView

    Gestures in iOS are not aware of each other, so if you'd like to use multiple gestures simultaneously, here is one example tutorial I found that covered the subject.

    Does this give you a better idea of how it's laid out?

Children