From 983f632b76795810299c9b4e37202a4231dd594c Mon Sep 17 00:00:00 2001 From: Gian Franco Zabarino Date: Tue, 5 May 2015 16:59:57 -0300 Subject: [PATCH] Added delegate method to notify the client when the navigation bar became fully contracted. --- TLYShyNavBar/TLYShyNavBarManager.h | 1 + TLYShyNavBar/TLYShyNavBarManager.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/TLYShyNavBar/TLYShyNavBarManager.h b/TLYShyNavBar/TLYShyNavBarManager.h index 080e4cc..0c513db 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.h +++ b/TLYShyNavBar/TLYShyNavBarManager.h @@ -72,6 +72,7 @@ @optional +- (void)shyNavBarManagerDidBecomeFullyContracted:(TLYShyNavBarManager *) shyNavBarManager; - (void)shyNavBarManagerDidFinishContracting:(TLYShyNavBarManager *) shyNavBarManager; - (void)shyNavBarManagerDidFinishExpanding:(TLYShyNavBarManager *) shyNavBarManager; diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index bd3e011..949eee3 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -295,6 +295,11 @@ static inline CGFloat AACStatusBarHeight() scrollInsets.top = MAX(maxNavY, maxExtensionY); } if (!UIEdgeInsetsEqualToEdgeInsets(self.scrollView.scrollIndicatorInsets, scrollInsets)) { + if (scrollInsets.top == AACStatusBarHeight()) { + if ([self.delegate respondsToSelector:@selector(shyNavBarManagerDidBecomeFullyContracted:)]) { + [self.delegate shyNavBarManagerDidBecomeFullyContracted:self]; + } + } self.scrollView.scrollIndicatorInsets = scrollInsets; } }