chameleon icon indicating copy to clipboard operation
chameleon copied to clipboard

Navigation Bar title and back button color not changing with setThemeUsingPrimaryColor

Open avyayv opened this issue 8 years ago • 9 comments

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...

avyayv avatar Sep 12 '16 23:09 avyayv

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]];

bre7 avatar Sep 15 '16 17:09 bre7

@avyayv Are you sure you're not overriding the tint color somewhere else in your code?

vicc avatar Sep 15 '16 18:09 vicc

Yes I'm sure I'm not.

avyayv avatar Sep 15 '16 22:09 avyayv

When I run demo project, not chaning with setThemeUsingprimaryColor, swift 3, iOS 10, Xcode 8.

MinsungHuh avatar Oct 13 '16 01:10 MinsungHuh

Confirmed.

Steps to reproduce:

  1. Use Demo project
  2. Remove theme code inside AppDelegate
  3. 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)

bre7 avatar Oct 13 '16 15:10 bre7

chameleon_application chameleon_viewcontroller ![chameleon_result](https://cloud.githubusercontent.com/assets/8328382/19372868/8c63a94c-91fa-11e6-82f7-d06f32f62bb7.png)

It does not seem to be working properly.

MinsungHuh avatar Oct 14 '16 01:10 MinsungHuh

Is there any update on this?

niclashedam avatar Jun 28 '17 21:06 niclashedam

This issue also occurs to the tintColors on SFSafariViewControllers.

j-pk avatar Nov 30 '17 17:11 j-pk

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

User2004 avatar Jan 15 '19 11:01 User2004