exploring adding the extension view as a subview to the navbar..
This commit is contained in:
parent
7e10314d2f
commit
82879cff0c
|
|
@ -69,7 +69,7 @@ static inline CGFloat AACStatusBarHeight()
|
||||||
self.extensionController.expandedCenter = ^(UIView *view)
|
self.extensionController.expandedCenter = ^(UIView *view)
|
||||||
{
|
{
|
||||||
return CGPointMake(CGRectGetMidX(view.bounds),
|
return CGPointMake(CGRectGetMidX(view.bounds),
|
||||||
CGRectGetMidY(view.bounds) + weakSelf.viewController.topLayoutGuide.length);
|
CGRectGetMidY(view.bounds) + CGRectGetHeight(weakSelf.navBarController.view.bounds));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|
@ -93,10 +93,12 @@ static inline CGFloat AACStatusBarHeight()
|
||||||
{
|
{
|
||||||
_viewController = viewController;
|
_viewController = viewController;
|
||||||
|
|
||||||
[self.extensionViewsContainer removeFromSuperview];
|
UIView *navbar = viewController.navigationController.navigationBar;
|
||||||
[self.viewController.view addSubview:self.extensionViewsContainer];
|
|
||||||
|
|
||||||
self.navBarController.view = viewController.navigationController.navigationBar;
|
[self.extensionViewsContainer removeFromSuperview];
|
||||||
|
[navbar insertSubview:self.extensionViewsContainer atIndex:0];
|
||||||
|
|
||||||
|
self.navBarController.view = navbar;
|
||||||
|
|
||||||
[self _layoutViews];
|
[self _layoutViews];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,13 @@ const CGFloat contractionVelocity = 140.f;
|
||||||
return CGPointMake(self.expandedCenterValue.x, self.expandedCenterValue.y - self.contractionAmountValue);
|
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
|
- (void)_updateSubviewsToAlpha:(CGFloat)alpha
|
||||||
{
|
{
|
||||||
for (UIView* view in self.view.subviews)
|
for (UIView* view in self.view.subviews)
|
||||||
{
|
{
|
||||||
bool isBackgroundView = view == self.view.subviews[0];
|
NSString *className = NSStringFromClass([view class]);
|
||||||
bool isViewHidden = view.hidden || view.alpha < FLT_EPSILON;
|
if (![className isEqualToString:@"_UINavigationBarBackground"] &&
|
||||||
|
![className isEqualToString:@"_UINavigationBarBackIndicatorView"])
|
||||||
if (!isBackgroundView && !isViewHidden)
|
|
||||||
{
|
{
|
||||||
view.alpha = alpha;
|
view.alpha = alpha;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue