Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Created March 15, 2018 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfversluis/37f01a46351ced978597505ad6e9b4e0 to your computer and use it in GitHub Desktop.
Save jfversluis/37f01a46351ced978597505ad6e9b4e0 to your computer and use it in GitHub Desktop.
Custom Tab title font for iOS
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using UIKit;
using TabbedPageDemo.iOS;
[assembly: ExportRenderer(typeof(TabbedPage), typeof(ExtendedTabbedPageRenderer))]
namespace TabbedPageDemo.iOS
{
public class ExtendedTabbedPageRenderer : TabbedRenderer
{
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
// Set Text Font for unselected tab states
UITextAttributes normalTextAttributes = new UITextAttributes
{
Font = UIFont.FromName("ComicSansMS", 9.0F) // unselected
};
UITabBarItem.Appearance.SetTitleTextAttributes(normalTextAttributes, UIControlState.Normal);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment