From ad96ff94f8a4e32db173b53eb528bde48fdf1b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xurxo=20Me=CC=81ndez=20Pe=CC=81rez?= Date: Wed, 16 Jul 2014 10:30:01 +0200 Subject: [PATCH 1/3] Added applicationDidBecomeActive behavior --- TLYShyNavBar/TLYShyNavBarManager.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 518d8c0..4ce95d6 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -100,6 +100,8 @@ static inline CGFloat AACStatusBarHeight() }; self.navBarController.child = self.extensionController; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:@"TLYShyApplicationDidBecomeActive" object:nil]; } return self; } @@ -111,6 +113,7 @@ static inline CGFloat AACStatusBarHeight() { _scrollView.delegate = _delegateProxy.originalDelegate; } + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"TLYShyApplicationDidBecomeActive" object:nil]; } #pragma mark - Properties @@ -318,6 +321,13 @@ static inline CGFloat AACStatusBarHeight() [self _handleScrollingEnded]; } +#pragma mark - Application did become active method + +- (void)applicationDidBecomeActive +{ + [self.navBarController expand]; +} + @end #pragma mark - UIViewController+TLYShyNavBar category From 4db193e0d29f1e8992a6c288a28c9b4fc4a564fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xurxo=20Me=CC=81ndez=20Pe=CC=81rez?= Date: Wed, 16 Jul 2014 10:45:03 +0200 Subject: [PATCH 2/3] Updated README.md --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index fa4c0b2..d66d60b 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,18 @@ self.shyNavBarManager.scrollView = self.scrollView; **IMPORTANT!!** If you are assigning a delegate to your scrollView, do that **before** assigning the scrollView to the `TLYShyNavBarManager`! To learn more, [see below](#how-it-works). +4. Post the `TLYShyApplicationDidBecomeActive` notification: + +```objc +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Other stuff... + [[NSNotificationCenter defaultCenter] postNotificationName:@"TLYShyApplicationDidBecomeActive" + object:nil]; + +} +``` + ## A Deeper Look The above example, while small, is complete! It makes the navigation bar enriched with humbility, that it will start getting out of the way when the scroll view starts scrolling. But, you may want to do more than that! From ed34a8dc908acc9c001b456e96a1078b10a1f560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xurxo=20Me=CC=81ndez=20Pe=CC=81rez?= Date: Wed, 16 Jul 2014 12:35:59 +0200 Subject: [PATCH 3/3] Using UIApplicationDidBecomeActiveNotification key --- README.md | 12 ------------ TLYShyNavBar/TLYShyNavBarManager.m | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d66d60b..fa4c0b2 100644 --- a/README.md +++ b/README.md @@ -63,18 +63,6 @@ self.shyNavBarManager.scrollView = self.scrollView; **IMPORTANT!!** If you are assigning a delegate to your scrollView, do that **before** assigning the scrollView to the `TLYShyNavBarManager`! To learn more, [see below](#how-it-works). -4. Post the `TLYShyApplicationDidBecomeActive` notification: - -```objc -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - // Other stuff... - [[NSNotificationCenter defaultCenter] postNotificationName:@"TLYShyApplicationDidBecomeActive" - object:nil]; - -} -``` - ## A Deeper Look The above example, while small, is complete! It makes the navigation bar enriched with humbility, that it will start getting out of the way when the scroll view starts scrolling. But, you may want to do more than that! diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 4ce95d6..93ac118 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -101,7 +101,7 @@ static inline CGFloat AACStatusBarHeight() self.navBarController.child = self.extensionController; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:@"TLYShyApplicationDidBecomeActive" object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil]; } return self; } @@ -113,7 +113,7 @@ static inline CGFloat AACStatusBarHeight() { _scrollView.delegate = _delegateProxy.originalDelegate; } - [[NSNotificationCenter defaultCenter] removeObserver:self name:@"TLYShyApplicationDidBecomeActive" object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; } #pragma mark - Properties