From 679d5caef14b47b6cef24c6baeb8f7f81367af33 Mon Sep 17 00:00:00 2001 From: Maz Jaleel Date: Sat, 14 Nov 2015 19:14:56 -0800 Subject: [PATCH] Minor fixes for different setups --- TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m | 2 +- TLYShyNavBar/TLYShyNavBarManager.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m index b40cafe..789c0a7 100644 --- a/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m +++ b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m @@ -40,7 +40,7 @@ return delta; } - if (normalizedY < 0) + if (normalizedY < -FLT_EPSILON) { CGRect frame = self.scrollView.frame; frame = UIEdgeInsetsInsetRect(frame, insets); diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 0fd3838..2a6710c 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -267,6 +267,9 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage self.resistanceConsumed = 0; } + // GTH: Calculate the exact point to avoid expansion resistance + // CGFloat statusBarHeight = [self.statusBarController calculateTotalHeightRecursively]; + // 5 - Apply resistance // 5.1 - Always apply resistance when contracting if (self.contracting) @@ -277,7 +280,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage deltaY = MIN(0, availableResistance + deltaY); } // 5.2 - Only apply resistance if expanding above the status bar - else if (self.scrollView.contentOffset.y > -[self.statusBarController calculateTotalHeightRecursively]) + else if (self.scrollView.contentOffset.y > 0) { CGFloat availableResistance = self.expansionResistance - self.resistanceConsumed; self.resistanceConsumed = MIN(self.expansionResistance, self.resistanceConsumed + deltaY);