diff --git a/TLYShyNavBar/ShyControllers/TLYShyViewController.m b/TLYShyNavBar/ShyControllers/TLYShyViewController.m index ad8e54d..1a77482 100644 --- a/TLYShyNavBar/ShyControllers/TLYShyViewController.m +++ b/TLYShyNavBar/ShyControllers/TLYShyViewController.m @@ -197,7 +197,7 @@ - (CGFloat)snap:(BOOL)contract return [self snap:contract completion:nil]; } -- (CGFloat)snap:(BOOL)contract completion:(void (^)())completion +- (CGFloat)snap:(BOOL)contract completion:(void (^)(BOOL contracting))completion { /* "The Facebook" UX dictates that: * @@ -211,21 +211,24 @@ - (CGFloat)snap:(BOOL)contract completion:(void (^)())completion */ __block CGFloat deltaY; + __block BOOL contracting = YES; [UIView animateWithDuration:0.2 animations:^ { if ((contract && self.subShyController.contracted) || (!contract && !self.expanded)) { deltaY = [self contract]; + contracting = YES; } else { deltaY = [self.subShyController expand]; + contracting = NO; } } completion:^(BOOL finished) { if (completion && finished) { - completion(); + completion(contracting); } }]; diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 63f3267..05b0646 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -342,11 +342,11 @@ - (void)_handleScrollingEnded } __weak __typeof(self) weakSelf = self; - void (^completion)() = ^ + void (^completion)(BOOL contracting) = ^(BOOL contracting) { __typeof(self) strongSelf = weakSelf; if (strongSelf) { - if (strongSelf.contracting) { + if (contracting) { if ([strongSelf.delegate respondsToSelector:@selector(shyNavBarManagerDidFinishContracting:)]) { [strongSelf.delegate shyNavBarManagerDidFinishContracting:strongSelf]; }