Created
March 15, 2018 08:19
-
-
Save jfversluis/37f01a46351ced978597505ad6e9b4e0 to your computer and use it in GitHub Desktop.
Custom Tab title font for iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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