Josh
Josh

Reputation: 615

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?

Upvotes: 4

Views: 2359

Answers (1)

pinedax
pinedax

Reputation: 9346

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.-

Upvotes: 8

Related Questions