Wrong navigation bar color
aminiz opened this issue · 6 comments
aminiz commented
The following line in AppDelegate makes navigationBar background and text color white.
Chameleon.setGlobalThemeUsingPrimaryColor(FlatMint(), withSecondaryColor: FlatBlue(), andContentStyle: UIContentStyle.Contrast)
bre7 commented
This line is the problem:
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
When trying to hide the hairline image, the translucency effect is also being disabled. More info: https://stackoverflow.com/a/32209688/2124535 and https://stackoverflow.com/a/19227158/2124535
Solution (works):
// Use swizzling in UIViewController and execute the following
- (void)swizzledMethod() {
[self findHairlineImageViewUnder:navigationBar].hidden = YES;
}
- (UIImageView *)findHairlineImageViewUnder:(UIView *)view {
if ([view isKindOfClass:UIImageView.class] && view.bounds.size.height <= 1.0) {
return (UIImageView *)view;
}
for (UIView *subview in view.subviews) {
UIImageView *imageView = [self findHairlineImageViewUnder:subview];
if (imageView) {
return imageView;
}
}
return nil;
}
Before/After fix
aminiz commented
Okay, that worked for me. But I had to make the change in Chameleon.m.
bre7 commented
Fix will be pushed soon ;)
aminiz commented
Thanks!
bre7 commented
Will do