This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Wrong navigation bar color #51
Labels
Comments
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 |
Okay, that worked for me. But I had to make the change in Chameleon.m. |
Fix will be pushed soon ;) |
Thanks! |
Thanks @bre7! Could you do a pull request with your fix? |
Will do |
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The following line in AppDelegate makes navigationBar background and text color white.
Chameleon.setGlobalThemeUsingPrimaryColor(FlatMint(), withSecondaryColor: FlatBlue(), andContentStyle: UIContentStyle.Contrast)
The text was updated successfully, but these errors were encountered: