exploring adding the extension view as a subview to the navbar..

This commit is contained in:
Mazyad Alabduljaleel 2014-06-15 15:11:37 +04:00
parent 7e10314d2f
commit 82879cff0c
2 changed files with 9 additions and 10 deletions

View File

@ -69,7 +69,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) + CGRectGetHeight(weakSelf.navBarController.view.bounds));
};
}
return self;
@ -93,10 +93,12 @@ static inline CGFloat AACStatusBarHeight()
{
_viewController = viewController;
[self.extensionViewsContainer removeFromSuperview];
[self.viewController.view addSubview:self.extensionViewsContainer];
UIView *navbar = viewController.navigationController.navigationBar;
self.navBarController.view = viewController.navigationController.navigationBar;
[self.extensionViewsContainer removeFromSuperview];
[navbar insertSubview:self.extensionViewsContainer atIndex:0];
self.navBarController.view = navbar;
[self _layoutViews];
}

View File

@ -37,16 +37,13 @@ const CGFloat contractionVelocity = 140.f;
return CGPointMake(self.expandedCenterValue.x, self.expandedCenterValue.y - self.contractionAmountValue);
}
// This method is courtesy of GTScrollNavigationBar
// https://github.com/luugiathuy/GTScrollNavigationBar
- (void)_updateSubviewsToAlpha:(CGFloat)alpha
{
for (UIView* view in self.view.subviews)
{
bool isBackgroundView = view == self.view.subviews[0];
bool isViewHidden = view.hidden || view.alpha < FLT_EPSILON;
if (!isBackgroundView && !isViewHidden)
NSString *className = NSStringFromClass([view class]);
if (![className isEqualToString:@"_UINavigationBarBackground"] &&
![className isEqualToString:@"_UINavigationBarBackIndicatorView"])
{
view.alpha = alpha;
}