diff --git a/TLYShyNavBar/TLYShyNavBarManager.h b/TLYShyNavBar/TLYShyNavBarManager.h index b0c53ff..920b9ae 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.h +++ b/TLYShyNavBar/TLYShyNavBarManager.h @@ -46,6 +46,8 @@ - (void)setExtensionView:(UIView *)view; +/* Needs to be called in viewWillAppear */ +- (void)prepareForDisplay; /* Needs to be called in viewDidLayoutSubviews */ - (void)layoutViews; /* Needs to be called in two places.. Please refer to the demo */ diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m index 3424051..668d22f 100644 --- a/TLYShyNavBar/TLYShyNavBarManager.m +++ b/TLYShyNavBar/TLYShyNavBarManager.m @@ -79,7 +79,7 @@ static inline CGFloat AACStatusBarHeight() self.extensionController.expandedCenter = ^(UIView *view) { return CGPointMake(CGRectGetMidX(view.bounds), - CGRectGetMidY(view.bounds) + weakSelf.viewController.topLayoutGuide.length); + CGRectGetMidY(view.bounds) + weakSelf.viewController.realTopLayoutGuide.length); }; self.navBarController.child = self.extensionController; @@ -198,10 +198,15 @@ static inline CGFloat AACStatusBarHeight() [self.extensionViewContainer addSubview:view]; } +- (void)prepareForDisplay +{ + [self.navBarController expand]; +} + - (void)layoutViews { [self.navBarController expand]; - + UIEdgeInsets scrollInsets = self.scrollView.contentInset; scrollInsets.top = CGRectGetHeight(self.extensionViewContainer.bounds) + self.viewController.topLayoutGuide.length; diff --git a/TLYShyNavBar/TLYShyViewController.m b/TLYShyNavBar/TLYShyViewController.m index 7e1c317..9616df9 100644 --- a/TLYShyNavBar/TLYShyViewController.m +++ b/TLYShyNavBar/TLYShyViewController.m @@ -129,6 +129,13 @@ const CGFloat contractionVelocity = 300.f; - (CGFloat)expand { + self.view.hidden = NO; + + if (self.hidesSubviews) + { + [self _updateSubviewsToAlpha:1.f]; + } + CGFloat amountToMove = self.expandedCenterValue.y - self.view.center.y; self.view.center = self.expandedCenterValue;