In my Xamarin iOS app I am trying to hide the top border and change the font family of TabbedPage. For Xamarin version 5.0.0.2021 it works fine. However when I update Xamarin version to 5.0.0.2244 it doesn't seem to work? There must be something unusual here. This is how I changed the font Family and Border Top TabbedPage:
MyTabbedPageRenderer
Change icon size, fontsize, font family,... TabbedPage
[assembly: ExportRenderer(typeof(TabbedPage), typeof(MyTabbedPageRenderer))]
....
public class MyTabbedPageRenderer : TabbedRenderer
{
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
TabBar.TintColor = UIColor.Gray;
TabBar.BarTintColor = UIColor.White;
TabBar.BackgroundColor = UIColor.White;
}
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
if (TabBar?.Items == null)
return;
foreach (var item in TabBar.Items)
{
item.Image = ScalingImageToSize(item.Image, new CGSize(30, 30)); // set the size here as you want
}
var tabs = Element as TabbedPage;
if (tabs != null)
{
for (int i = 0; i < TabBar.Items.Length; i++)
{
UpdateTabBarItem(TabBar.Items[i]);
}
}
}
private void UpdateTabBarItem(UITabBarItem item)
{
if (item == null)
return;
// Set the font for the title.
item.SetTitleTextAttributes(new UITextAttributes() { Font = UIFont.FromName("Quicksand Regular", 12), TextColor = Color.FromHex("#808080").ToUIColor() }, UIControlState.Normal);
item.SetTitleTextAttributes(new UITextAttributes() { Font = UIFont.FromName("Quicksand Regular", 13), TextColor = Color.FromHex("#00AA13").ToUIColor() }, UIControlState.Selected);
}
...
}
Remove border top TabbedPage
AppDelegate
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
UITabBar.Appearance.BackgroundImage = new UIImage();
UITabBar.Appearance.ShadowImage = new UIImage();
UITabBar.Appearance.SelectedImageTintColor = UIColor.FromRGB(0, 170, 19);
LoadApplication(new App());
}
I tried rebuilding the project, restarting everything, but it doesn't seem to work on Xamarin version 5.0.0.2244. Ask for help. Thanks.