From baffc6fe0d4571d45c89cb147bdb7529a50012db Mon Sep 17 00:00:00 2001 From: Mazyad Alabduljaleel Date: Tue, 20 Oct 2015 19:54:29 -0700 Subject: [PATCH] fixes #93 .. As far as I can tell --- TLYShyNavBar/TLYShyNavBarManager.m | 14 ++++++++++++-- TLYShyNavBar/TLYShyViewController.h | 4 +++- TLYShyNavBar/TLYShyViewController.m | 5 +++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 1519a1f..fd64e11 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -72,7 +72,7 @@ @interface TLYShyStatusBarController : NSObject @implementation TLYShyStatusBarController -- (CGFloat)viewMaxY +- (CGFloat)_statusBarHeight { CGFloat statusBarHeight = AACStatusBarHeight(self.viewController); /* The standard status bar is 20 pixels. The navigation bar extends 20 pixels up so it is overlapped by the status bar. @@ -87,6 +87,16 @@ - (CGFloat)viewMaxY return statusBarHeight; } +- (CGFloat)viewMaxY +{ + return [self _statusBarHeight]; +} + +- (CGFloat)calculateTotalHeightRecursively +{ + return [self _statusBarHeight]; +} + @end @@ -417,7 +427,7 @@ - (void)prepareForDisplay - (void)layoutViews { UIEdgeInsets scrollInsets = self.scrollView.contentInset; - scrollInsets.top = self.extensionController.viewMaxY; + scrollInsets.top = [self.extensionController calculateTotalHeightRecursively]; if (UIEdgeInsetsEqualToEdgeInsets(scrollInsets, self.previousScrollInsets)) { diff --git a/TLYShyNavBar/TLYShyViewController.h b/TLYShyNavBar/TLYShyViewController.h index d4bbb56..83554df 100644 --- a/TLYShyNavBar/TLYShyViewController.h +++ b/TLYShyNavBar/TLYShyViewController.h @@ -29,6 +29,8 @@ typedef NS_ENUM(NSInteger, TLYShyNavViewControllerFade) { @property (nonatomic, readonly) CGFloat viewMaxY; +- (CGFloat)calculateTotalHeightRecursively; + @end /* CLASS DESCRIPTION: @@ -56,8 +58,8 @@ typedef NS_ENUM(NSInteger, TLYShyNavViewControllerFade) { */ @property (nonatomic) BOOL sticky; -- (CGFloat)updateYOffset:(CGFloat)deltaY; - (void)offsetCenterBy:(CGPoint)deltaPoint; +- (CGFloat)updateYOffset:(CGFloat)deltaY; - (CGFloat)snap:(BOOL)contract; diff --git a/TLYShyNavBar/TLYShyViewController.m b/TLYShyNavBar/TLYShyViewController.m index eb66e93..a271d17 100644 --- a/TLYShyNavBar/TLYShyViewController.m +++ b/TLYShyNavBar/TLYShyViewController.m @@ -16,6 +16,11 @@ - (CGFloat)viewMaxY return CGRectGetMaxY(self.view.frame); } +- (CGFloat)calculateTotalHeightRecursively +{ + return CGRectGetHeight(self.view.bounds) + [self.parent calculateTotalHeightRecursively]; +} + @end