2016-12-08 18 views
1

ナビゲーションバーのタイトルの色を変更する方法を知りたいと思います。これを迅速に行う方法です:Xamarin.iOSでナビゲーションバータイトルの色を変更する方法

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

Xamarin.iOSを使用してその動作を複製するにはどうすればよいですか?

答えはWhat to use for AttributeName in Xamarin Macとなりましたが、NSMutableAttributedStringからUIStringAttributesに変換できなかったため、これを動作させることができませんでした。

ありがとうございました。

答えて

2

これは、あなたがそれを行う方法です。

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) 
     }; 
    }