Hiding TabBar on iOS 11 no longer working.

AndrewHoffmanAndrewHoffman USUniversity ✭✭

Prior to iOS 11, I was using this code inside a custom renderer for the TabPage to conditionally hide the TabBar in my app:

private void ToggleTabs(object sender, bool hideTabs)
{
    TabBar.Hidden = hideTabs;

    TabBar.Frame = TabBar.Hidden
        ? new CGRect(TabBar.Frame.X, TabBar.Frame.Y, TabBar.Frame.Width, 0)
        : new CGRect(TabBar.Frame.X, TabBar.Frame.Y, TabBar.Frame.Width, tabBarHeight);
}

where tabBarHeight is calculated when the TabBar is constructed (it should always be 49 according to the docs, but I hate magic numbers).

The problem that I'm now running into is that even though I'm collapsing the frame, there is still a white rectangle left where the tab bar used to be. I have only noticed this behavior on devices running iOS 11 deployed from XCode 9.

I found some information about SafeAreaInsets that I thought may have been causing the problem, but 0 is always returned unless I'm running on an iPhone X, so that seems to have been a bust.

Any thoughts?

Sign In or Register to comment.