chameleon
chameleon copied to clipboard
Navigation Bar title and back button color not changing with setThemeUsingPrimaryColor
When I do
let someColor = arrayOfColors[2] as! UIColor
let anotherColor = arrayOfColors[1] as! UIColor
setThemeUsingPrimaryColor(someColor, withSecondaryColor: anotherColor, andContentStyle: .Contrast)
where arrayOfColors is an array of colors based on an image, I get the following for my Navigation Bar:
where the text isn't that great looking. I don't know if I'm doing something wrong, but the barbuttonitem is working fine so...
What was the expected result ?
Here's how Chameleon themes the Nav bar:
UIColor *contentColor = ContrastColor(primaryColor, NO); // When .Contrast is used
[[UINavigationBar appearanceWhenContainedIn:[self class], nil] setBarTintColor:primaryColor];
[[UINavigationBar appearanceWhenContainedIn:[self class], nil] setTintColor:contentColor];
[[UINavigationBar appearanceWhenContainedIn:[self class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName:contentColor}];
[[UINavigationBar appearanceWhenContainedIn:[self class], nil] setShadowImage:[UIImage new]];
@avyayv Are you sure you're not overriding the tint color somewhere else in your code?
Yes I'm sure I'm not.
When I run demo project, not chaning with setThemeUsingprimaryColor, swift 3, iOS 10, Xcode 8.
Confirmed.
Steps to reproduce:
- Use Demo project
- Remove theme code inside AppDelegate
- Add the following code to ViewController.swift
setThemeUsingPrimaryColor(.flatPlum, withSecondaryColor: .flatBlue, andContentStyle: .contrast)
Results:
- Pink color NavigationBar (set in Main.storyboard)
- Default tint color ("blue") Back button
Expected:
- NavigationBar should be colored with
.flatPlum
- Back button should be colored with
white
(since we are using.contrast
style)


It does not seem to be working properly.
Is there any update on this?
This issue also occurs to the tintColors on SFSafariViewControllers.
Write following link code in appdelegate.m file for set navigation bar tint color, font color apply font family etc.
https://webappcodes.com/set-navigation-bar-theme-in-objective-c
Hide navigation back button and set navigation title
https://webappcodes.com/set-navigation-bar-title-programmatically-and-hide-default-navigation-back-button-in-objective-c
Set navigation left button programatically in objective c
https://webappcodes.com/set-navigation-left-bar-button-in-objective-c