Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Xamarin.Forms Tab Bar height (iOS)

How to change the height of a Tab Bar in Xamarin.Forms (iOS)? Is it possible with TabbedRenderer?

like image 711
Josh Avatar asked Jan 29 '23 16:01

Josh


1 Answers

Yeah this is possible to modify from a CustomRenderer.

You will need to subclass the TabbedPage in the Forms project and use this class to export the render.

Then in the CustomRenderer override the ViewWillLayoutSubviews method. Something like:

public class MyTabbedPageRenderer : TabbedRenderer
{
    // Modify this variable with the height you desire.
    private readonly float tabBarHeight = 55f;

    public override void ViewWillLayoutSubviews()
    {
        base.ViewWillLayoutSubviews();

        TabBar.Frame = new CGRect(TabBar.Frame.X, TabBar.Frame.Y + (TabBar.Frame.Height - tabBarHeight), TabBar.Frame.Width, tabBarHeight);
    }
}

Hope this helps.-

like image 161
pinedax Avatar answered Feb 24 '23 03:02

pinedax