How to change title color Navigation color Controller in iOS using Xamarin

I am trying to change the title text of a NavigationController Color in iOS using Xamarin , but I cannot change it.

Can someone help me with this?

+7
ios xamarin uinavigationcontroller
source share
4 answers

I tried this way and it worked for me.

  var navigationBar = NavigationController.NavigationBar; navigationBar.SetTitleTextAttributes(new UITextAttributes() { TextColor = UIColor.White }); 

Sathish

Edit:

UINavigationBar no longer has the SetTitleTextAttributes method. Instead, you should set the TitleTextAttributes property to the UIStringAttributes property as follows:

 this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White }; 
+17
source share

This post is old, but I think this is what you need:

 this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White }; 

worked for the unified xamarin API

+4
source share

You cannot change it directly. Only through appearance or using your own representation as a name. Here is the solution for using appearance in Xamarin.iOS:

 UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.Purple }); 
+2
source share

titleTextAttributes Display attributes for the title of the title.

 @property(nonatomic, copy) NSDictionary *titleTextAttributes 

Discussion You can specify the font, text color, shadow text color, and text shadow offset for the title in the text attribute dictionary using the text attribute keys described in the NSString UIKit add-ons.

+1
source share

All Articles