1

Dans mon application, j'ai donné à la barre de navigation la couleur du bouton rouge. La flèche et le texte fonctionnent parfaitement avec l'iPhone sur tous les écrans. Mais dans iPad il fonctionne correctement uniquement pour l'écran d'accueil. Lorsque j'entre dans l'un des autres contrôleurs de vue, mon texte de navigation arrière est en rouge mais la flèche du bouton arrière devient de couleur grise. Voici mon code,La couleur du bouton de navigation de la barre arrière ne fonctionne pas dans l'iPad

func setup() { 
    self.navigationBar.barTintColor = UIColor.blue() 
    UINavigationBar.appearance().titleTextAttributes = [ 
     NSForegroundColorAttributeName : UIColor.white, 
     NSFontAttributeName : UIFont(name: "Arial", size: CGFloat(22.0))! 
    ] 
    self.navigationBar.isTranslucent = true 
    UINavigationBar.appearance().tintColor = UIColor.red 

//  self.navigationBar.tintColor = UIColor(red: CGFloat(132.0/255.0), green: CGFloat(204.0/255.0), blue: CGFloat(90.0/255.0), alpha: CGFloat(1.0)) 

    // Draw a bottom border 
    let bottomBorderHeight = 3/UIScreen.main.scale 
    let bottomBorder = UIView(frame: CGRect(x: CGFloat(0), y: CGFloat(self.navigationBar.frame.size.height-bottomBorderHeight), width: CGFloat(self.view.bounds.width), height: CGFloat(bottomBorderHeight))) 
    bottomBorder.backgroundColor = UIColor(red: CGFloat(0/255.0), green: CGFloat(97/255.0), blue: CGFloat(56/255.0), alpha: CGFloat(1.0)) 
    self.navigationBar.addSubview(bottomBorder) 
} 

Essayé barTintcolor, apparence, style de barre etc. mais rien ne fonctionne. Une idée? TIA.

+0

Est-ce que 'tintAdjustmentMode' aide? – Puttin

+0

quand appellerez-vous cette méthode func setup()? – KKRocks

+0

essayer de remplacer/ajouter ces lignes avec le vôtre UINavigationBar.appearance(). IsTranslucent = true UINavigationBar.appearance(). TintColor = UIColor.red UINavigationBar.appearance(). BarTintColor = UIColor.blue – KKRocks

Répondre

-1

Swift 3, essayez cette ligne pour revenir bouton changement de couleur

self.navigationController?.navigationBar.tintColor = UIColor.red 

J'espère que ce travail pour vous,