From b34d0b7baa84919a17a5149389648fc20bc4c7f3 Mon Sep 17 00:00:00 2001 From: brightsider Date: Thu, 29 Oct 2015 14:47:52 +0200 Subject: [PATCH 1/5] Fix alpha formula --- Pod/Classes/JDFPeekabooCoordinator.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/JDFPeekabooCoordinator.m b/Pod/Classes/JDFPeekabooCoordinator.m index c241f58..da8d649 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.m +++ b/Pod/Classes/JDFPeekabooCoordinator.m @@ -340,7 +340,7 @@ - (CGFloat)topViewPercentageHidden { CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; CGRect frame = self.topView.frame; - CGFloat percentage = (self.topViewDefaultY - frame.origin.y - (self.topViewDefaultY - statusBarHeight)) / (frame.size.height - 1 - self.topViewMinimisedHeight); + CGFloat percentage = 1 - (frame.size.height + frame.origin.y - self.topViewMinimisedHeight) / (frame.size.height - self.topViewMinimisedHeight); return percentage; } From 846d54f8358bc0e451701b35f4aeccc904f9a5e2 Mon Sep 17 00:00:00 2001 From: brightsider Date: Thu, 5 Nov 2015 22:22:09 +0200 Subject: [PATCH 2/5] remove unused string --- Pod/Classes/JDFPeekabooCoordinator.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Pod/Classes/JDFPeekabooCoordinator.m b/Pod/Classes/JDFPeekabooCoordinator.m index da8d649..6dd7a50 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.m +++ b/Pod/Classes/JDFPeekabooCoordinator.m @@ -338,7 +338,6 @@ - (void)animateBottomViewToYPosition:(CGFloat)y - (CGFloat)topViewPercentageHidden { - CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; CGRect frame = self.topView.frame; CGFloat percentage = 1 - (frame.size.height + frame.origin.y - self.topViewMinimisedHeight) / (frame.size.height - self.topViewMinimisedHeight); return percentage; From c5b6b97cef1cc1266b2ec53182ffcbf6e9f1994e Mon Sep 17 00:00:00 2001 From: brightsider Date: Wed, 30 Dec 2015 12:54:44 +0200 Subject: [PATCH 3/5] add animation var for expand and hide views --- Pod/Classes/JDFPeekabooCoordinator.h | 10 ++++++++ Pod/Classes/JDFPeekabooCoordinator.m | 37 +++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Pod/Classes/JDFPeekabooCoordinator.h b/Pod/Classes/JDFPeekabooCoordinator.h index d428943..6c35b10 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.h +++ b/Pod/Classes/JDFPeekabooCoordinator.h @@ -61,11 +61,21 @@ */ - (void)fullyExpandViews; +/** + * Returns all of the views to their default position. + */ +- (void)fullyExpandViewsAnimated:(BOOL)animated; + /** * Moves all of the views to their minimised position; */ - (void)fullyHideViews; +/** + * Moves all of the views to their minimised position; + */ +- (void)fullyHideViewsAnimated:(BOOL)animated; + #pragma mark - Enabling/Disabling diff --git a/Pod/Classes/JDFPeekabooCoordinator.m b/Pod/Classes/JDFPeekabooCoordinator.m index 6dd7a50..b04d1a1 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.m +++ b/Pod/Classes/JDFPeekabooCoordinator.m @@ -117,15 +117,40 @@ - (void)setBarsNeedDisplay - (void)fullyExpandViews { - [self animateTopViewToYPosition:self.topViewDefaultY]; - [self animateBottomViewToYPosition:(self.containingView.frame.size.height - self.bottomBarDefaultHeight)]; + [self fullyExpandViewsAnimated:NO]; +} + +- (void)fullyExpandViewsAnimated:(BOOL)animated +{ + void (^block)() = ^() { + [self animateTopViewToYPosition:self.topViewDefaultY]; + [self animateBottomViewToYPosition:(self.containingView.frame.size.height - self.bottomBarDefaultHeight)]; + }; + + if (animated) { + [UIView performWithoutAnimation:block]; + } else { + block(); + } [self setBarsNeedDisplay]; } - (void)fullyHideViews { - [self animateTopViewToYPosition:[self topViewMinimisedY]]; - [self animateBottomViewToYPosition:[self bottomViewMinimisedY]]; + [self fullyHideViewsAnimated:NO]; +} + +- (void)fullyHideViewsAnimated:(BOOL)animated +{ + void (^block)() = ^() { + [self animateTopViewToYPosition:[self topViewMinimisedY]]; + [self animateBottomViewToYPosition:[self bottomViewMinimisedY]]; + }; + if (animated) { + [UIView performWithoutAnimation:block]; + } else { + block(); + } [self setBarsNeedDisplay]; } @@ -240,7 +265,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView CGFloat topViewPercentageHidden = [self topViewPercentageHidden]; [self updateTopViewSubviews:(1 - topViewPercentageHidden)]; - + self.previousScrollViewYOffset = scrollOffset; } @@ -296,7 +321,7 @@ - (void)updateTopViewSubviews:(CGFloat)alpha } else if (alpha < 0.0f) { alpha = 0.0f; } - + for (UIView *view in self.topViewItems) { view.alpha = alpha; } From a645b59068e21c47c481088081c8266d2d6a108b Mon Sep 17 00:00:00 2001 From: brightsider Date: Wed, 30 Dec 2015 13:00:24 +0200 Subject: [PATCH 4/5] fix issue --- Pod/Classes/JDFPeekabooCoordinator.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pod/Classes/JDFPeekabooCoordinator.m b/Pod/Classes/JDFPeekabooCoordinator.m index b04d1a1..2162a7a 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.m +++ b/Pod/Classes/JDFPeekabooCoordinator.m @@ -127,7 +127,7 @@ - (void)fullyExpandViewsAnimated:(BOOL)animated [self animateBottomViewToYPosition:(self.containingView.frame.size.height - self.bottomBarDefaultHeight)]; }; - if (animated) { + if (!animated) { [UIView performWithoutAnimation:block]; } else { block(); @@ -146,7 +146,7 @@ - (void)fullyHideViewsAnimated:(BOOL)animated [self animateTopViewToYPosition:[self topViewMinimisedY]]; [self animateBottomViewToYPosition:[self bottomViewMinimisedY]]; }; - if (animated) { + if (!animated) { [UIView performWithoutAnimation:block]; } else { block(); From 0f6ee3c9e3993eb784db82c54faa07f6c8b77bd1 Mon Sep 17 00:00:00 2001 From: brightsider Date: Mon, 11 Jan 2016 11:00:06 +0200 Subject: [PATCH 5/5] fix issue with titleView at push controller --- Pod/Classes/JDFPeekabooCoordinator.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Pod/Classes/JDFPeekabooCoordinator.m b/Pod/Classes/JDFPeekabooCoordinator.m index 2162a7a..8e610df 100644 --- a/Pod/Classes/JDFPeekabooCoordinator.m +++ b/Pod/Classes/JDFPeekabooCoordinator.m @@ -345,8 +345,10 @@ - (void)animateTopViewToYPosition:(CGFloat)y frame.origin.y = y; [self.topView setFrame:frame]; [self updateTopViewSubviews:alpha]; - } completion:^(BOOL finished) { + [self setBarsNeedDisplay]; + } completion:^(BOOL finished) { + //[self setBarsNeedDisplay]; }]; } @@ -356,8 +358,9 @@ - (void)animateBottomViewToYPosition:(CGFloat)y CGRect frame = self.bottomView.frame; frame.origin.y = y; [self.bottomView setFrame:frame]; - } completion:^(BOOL finished) { [self setBarsNeedDisplay]; + } completion:^(BOOL finished) { + //[self setBarsNeedDisplay]; }]; }