2

I am using the ecsliding for a menu in my app. I was wondering how to know when the menu is open and when it has control. I am trying to do themes in the menu and am having issues because I "reset" the colours on viewdidload and viewdidappear (for the main "top" view controller").

Essentially :

User opens menu, selects colour, closes menu and colours should change... but since the rightviewcontroller is not actually being fully "added" I don't think the viewdidload and viewdidappear methods get called when I close the menu...

Sorry for the rambling...

Any help?

Thanks

Andy

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Andy
  • 479
  • 7
  • 20

1 Answers1

5

According to the docs you should be able to interrogate the currentTopViewPosition property.

This is defined as

typedef NS_ENUM(NSInteger, ECSlidingViewControllerTopViewPosition) {
    /** The top view is on anchored to the left */
    ECSlidingViewControllerTopViewPositionAnchoredLeft,
    /** The top view is on anchored to the right */
    ECSlidingViewControllerTopViewPositionAnchoredRight,
    /** The top view is centered */
    ECSlidingViewControllerTopViewPositionCentered
};

It looks like you can access the instance of ECSlidingViewController that contains your view controller using the UIViewController(ECSlidingViewController)category methodslidingViewController`

Paul.s
  • 38,494
  • 5
  • 70
  • 88
  • Now would I do this in my topviewcontroller class? – Andy Feb 17 '14 at 22:07
  • Okay I will try this - appreciate it – Andy Feb 17 '14 at 22:55
  • I am confused on how to use this to my advantage... I want to know if the top view is anchored this is good...but how do I make a method in my topview controller to constantly look for this? Or how do I message the top view that the menu has just been closed? – Andy Feb 18 '14 at 00:58
  • 2
    @asavu please post exactly what you figured out for others, thanks. – mcphersonjr Feb 19 '14 at 22:59
  • How would I go about doing that ? In a new post or a comment or what? I would like to share what I learned from this. Thanks – Andy Feb 20 '14 at 04:31
  • Hi, what is the method that its being called when the menu is open? Thanks – VAAA May 09 '16 at 23:06