2016-12-08 1 views
1

Ich würde gerne wissen, wie man die Farbe der Navigationsleiste ändert. Dies ist, wie sollte es in schnellen erfolgen:Wie ändere ich die Titelfarbe der Navigationsleiste auf Xamarin.iOS

UINavigationBar.appearance().titleTextAttributes = 
          [NSForegroundColorAttributeName : UIColor.white] 

Wie kann ich dieses Verhalten mit Xamarin.iOS replizieren?

Ich habe versucht, mit den Antworten hier What to use for AttributeName in Xamarin Mac zu arbeiten, aber ich konnte es nicht funktionieren, weil es nicht von NSMutableAttributedString zu UIStringAttributes konvertieren konnte.

Danke.

Antwort

2

Dies ist, wie Sie das tun:

UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes 
{ 
    ForegroundColor = UIColor.White 
}; 
2
void StyleNavBar() 
    { 
     this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes() 
     { 
      ForegroundColor = UIColor.White, 
      Font = UIFont.FromName("overpass-bold", 14) 
     }; 
    } 
Verwandte Themen