nverinaud / NVSlideMenuController

A slide menu done right for iOS.
MIT License
175 stars 33 forks source link

Add option to bounce the content view when navigating. #7

Closed DavidBarry closed 11 years ago

DavidBarry commented 11 years ago

This adds a BOOL flag bounceWhenNavigating as well as the method - (void)closeMenuBehindContentViewController: animated: bounce: completion:. Setting bounceWhenNavigating to YES or passing YES to the bounce parameter will cause the content view to bounce off screen briefly before swapping out the new content view controller and sliding back into the closed position. This mimics the behavior seen in Path when selecting an item from the menu.

When bouncing has been enabled it will usually look bad if the menu isn't as wide as the SlideMenuController's view. To help with this I added another bool flag autoAdjustMenuWidth that will prevent NSSlideMenuController from resizing the menu to compensate for contentViewWidthWhenMenuIsOpen and will instead ensure that the menu is always as wide as NSSlideMenuController's view. This is controlled independently of bounceWhenNavigating so that the user isn't forced to give up the menu resizing when using bouncing.

I've also added some switches in the Demo app to demonstrate the functionality.

bounceWhenNavigating defaults to NO and autoAdjustMenuWidth defaults to YES to preserve the previous behavior in default configurations.

nverinaud commented 11 years ago

Sorry for my non-reactivity on this one. Could you please squash your commits? Thanks for your contribution, when squashed I'd merge this great stuff :)

DavidBarry commented 11 years ago

Just rebased onto develop and squashed the commits. Let me know if this looks good.

nverinaud commented 11 years ago

Well done! I've included your changes in the 1.5.0. And it's available through cocoapods from now :+1:

DavidBarry commented 11 years ago

Thanks Nicolas.