Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing ECSlidingViewController menu

I'd like to implement my sliding menu in a way that pressing the Menu button will show my menu and pressing Menu again would hide it. But I can't understand how to do it with ECSlidingViewController. Will appreciate any help.

like image 640
devmiles.com Avatar asked Dec 27 '13 14:12

devmiles.com


1 Answers

ECSlidingViewController has methods for this: anchorTopViewToRightAnimated:, anchorTopViewToLeftAnimated: and resetTopViewAnimated:.

Example in your top view controller:

[self.slidingViewController anchorTopViewToRightAnimated:YES]

ECSlidingViewController provides a category for UIViewController adding this slidingViewController property.

You may also want to use ECSlidingViewController's currentTopViewPosition to determine if your button should show your menu or hide it in the current context.

like image 172
kketch Avatar answered Sep 20 '22 18:09

kketch