gresrun / GHSidebarNav

A clone of the new Facebook iOS UI paradigm
Apache License 2.0
607 stars 136 forks source link

Open/Close SidebarNav Swiping #26

Closed mabril closed 11 years ago

mabril commented 11 years ago

How can we do this action by swiping the screen to the left for hiding and to the right to showing?

Thanks, you made a good job!

gresrun commented 11 years ago

You can install a UIPanGestureRecognizer on each of the views that you want to allow swiping to open/close the menu. The Demo already does allows swiping on the nav bars but you can make the whole view swipe-able like so:

    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.revealController                                                                        
                                                                                 action:@selector(dragContentView:)];
    panGesture.cancelsTouchesInView = YES;
    [contentVC.view addGestureRecognizer:panGesture];
gresrun commented 11 years ago

Closing, feel free to reopen if you have any other questions.