Xamarin-150

Using Custom Fonts in Xamarin iOS

Using  a custom font to add character to your App is simple with Xamarin iOS.

Adding the font

Simply add the font files to your application and ensure their build action is set to “BundleResource”. Note: iOS supports TTF and OTF fonts.

Next, set the font files to be copied to the output directory.

Configure Info.plist

We need to instruct iOS that we are providing custom fonts.

Open info.plist > source > add new entry

Using the custom font

Creating a UIFont:


var font = UIFont.FromName ("segoeui", 16);

Using UIAppearance to set the title font on a navigation bar


var textAttributes = new UITextAttributes {
  Font = UIFont.FromName("segoeui", 22),
};
UINavigationBar.Appearance.SetTitleTextAttributes(textAttributes); 

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>