Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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