Skip to content

Commit

Permalink
Another topBar background fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd committed Dec 19, 2019
1 parent 0b9550f commit f202c7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions lib/ios/TopBarAppearancePresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ @interface TopBarAppearancePresenter ()
@implementation TopBarAppearancePresenter {
UINavigationBarAppearance* _appearance;
}
@synthesize backgroundColor = _backgroundColor;
@synthesize translucent = _translucent;

- (instancetype)initWithNavigationController:(UINavigationController *)boundNavigationController {
self = [super initWithNavigationController:boundNavigationController];
Expand All @@ -20,25 +18,20 @@ - (instancetype)initWithNavigationController:(UINavigationController *)boundNavi
}

- (void)setTranslucent:(BOOL)translucent {
_translucent = translucent;
[super setTranslucent:translucent];
[self updateBackgroundAppearance];
}

- (void)setTransparent:(BOOL)transparent {
[self updateBackgroundAppearance];
}

- (void)setBackgroundColor:(UIColor *)backgroundColor {
_backgroundColor = backgroundColor;
[self updateBackgroundAppearance];
}

- (void)updateBackgroundAppearance {
if (self.transparent) {
[_appearance configureWithTransparentBackground];
} else if (_backgroundColor) {
[_appearance setBackgroundColor:_backgroundColor];
} else if (_translucent) {
} else if (self.backgroundColor) {
[_appearance setBackgroundColor:self.backgroundColor];
} else if (self.translucent) {
[_appearance configureWithDefaultBackground];
} else {
[_appearance configureWithOpaqueBackground];
Expand Down
2 changes: 1 addition & 1 deletion lib/ios/TopBarPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ - (void)setBackButtonIcon:(UIImage *)icon withColor:(UIColor *)color title:(NSSt
}

- (BOOL)transparent {
return (_backgroundColor && CGColorGetAlpha(_backgroundColor.CGColor) == 0.0);
return (self.backgroundColor && CGColorGetAlpha(self.backgroundColor.CGColor) == 0.0);
}

@end

0 comments on commit f202c7e

Please sign in to comment.