From b0eb160d308bf6e9d2ecc6a972bd3d1cd0c55f1d Mon Sep 17 00:00:00 2001 From: AhnQiraj Date: Mon, 11 Apr 2016 23:31:51 +0800 Subject: [PATCH] Fix because of navigationbar have color and translucent causes bug --- LTNavigationBar/UINavigationBar+Awesome.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/LTNavigationBar/UINavigationBar+Awesome.m b/LTNavigationBar/UINavigationBar+Awesome.m index 4c51f40..98f9f0b 100644 --- a/LTNavigationBar/UINavigationBar+Awesome.m +++ b/LTNavigationBar/UINavigationBar+Awesome.m @@ -9,8 +9,12 @@ #import "UINavigationBar+Awesome.h" #import + + @implementation UINavigationBar (Awesome) static char overlayKey; +static UIColor *color; +static bool translucent; - (UIView *)overlay { @@ -25,6 +29,10 @@ - (void)setOverlay:(UIView *)overlay - (void)lt_setBackgroundColor:(UIColor *)backgroundColor { if (!self.overlay) { + translucent = self.translucent; + color = self.backgroundColor; + [self setBackgroundColor:[UIColor clearColor]]; + [self setTranslucent:YES]; [self setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.overlay = [[UIView alloc] initWithFrame:CGRectMake(0, -20, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) + 20)]; self.overlay.userInteractionEnabled = NO; @@ -65,6 +73,8 @@ - (void)lt_reset [self setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; [self.overlay removeFromSuperview]; self.overlay = nil; + self.backgroundColor = color; + self.translucent = translucent; } @end