@@ -136,19 +136,41 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO
136136 self.view .layer .shadowOpacity = MENU_SHADOW_OPACITY;
137137}
138138
139- - (void )updateMenuFrameAndTransformAccordingToOrientation
140- {
141- // Animate rotatation when menu is open and device rotates
142- CGAffineTransform transform = self.view .transform ;
143- self.leftMenu .view .transform = transform;
144- self.rightMenu .view .transform = transform;
145-
146- self.leftMenu .view .frame = [self initialRectForMenu ];
147- self.rightMenu .view .frame = [self initialRectForMenu ];
148- }
149-
150139#pragma mark - Public Methods -
151140
141+ - (void )bounceMenu : (Menu)menu withCompletion : (void (^)())completion
142+ {
143+ [self prepareMenuForReveal: menu forcePrepare: YES ];
144+ NSInteger movementDirection = (menu == MenuLeft) ? 1 : -1 ;
145+
146+ [UIView animateWithDuration: .16 delay: 0 options: UIViewAnimationOptionCurveEaseOut animations: ^{
147+ [self moveHorizontallyToLocation: 30 *movementDirection];
148+ } completion: ^(BOOL finished){
149+ [UIView animateWithDuration: .1 delay: 0 options: UIViewAnimationOptionCurveEaseIn animations: ^{
150+ [self moveHorizontallyToLocation: 0 ];
151+ } completion: ^(BOOL finished){
152+ [UIView animateWithDuration: .12 delay: 0 options: UIViewAnimationOptionCurveEaseOut animations: ^{
153+ [self moveHorizontallyToLocation: 16 *movementDirection];
154+ } completion: ^(BOOL finished){
155+ [UIView animateWithDuration: .08 delay: 0 options: UIViewAnimationOptionCurveEaseIn animations: ^{
156+ [self moveHorizontallyToLocation: 0 ];
157+ } completion: ^(BOOL finished){
158+ [UIView animateWithDuration: .08 delay: 0 options: UIViewAnimationOptionCurveEaseOut animations: ^{
159+ [self moveHorizontallyToLocation: 6 *movementDirection];
160+ } completion: ^(BOOL finished){
161+ [UIView animateWithDuration: .06 delay: 0 options: UIViewAnimationOptionCurveEaseIn animations: ^{
162+ [self moveHorizontallyToLocation: 0 ];
163+ } completion: ^(BOOL finished){
164+ if (completion)
165+ completion ();
166+ }];
167+ }];
168+ }];
169+ }];
170+ }];
171+ }];
172+ }
173+
152174- (void )switchToViewController : (UIViewController *)viewController withCompletion : (void (^)())completion
153175{
154176 if (self.avoidSwitchingToSameClassViewController && [self .topViewController isKindOfClass: viewController.class])
@@ -262,6 +284,17 @@ - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BO
262284
263285#pragma mark - Private Methods -
264286
287+ - (void )updateMenuFrameAndTransformAccordingToOrientation
288+ {
289+ // Animate rotatation when menu is open and device rotates
290+ CGAffineTransform transform = self.view .transform ;
291+ self.leftMenu .view .transform = transform;
292+ self.rightMenu .view .transform = transform;
293+
294+ self.leftMenu .view .frame = [self initialRectForMenu ];
295+ self.rightMenu .view .frame = [self initialRectForMenu ];
296+ }
297+
265298- (void )enableTapGestureToCloseMenu : (BOOL )enable
266299{
267300 if (enable)
0 commit comments