Xamarin.forms: [iOS] HidesBottomBarWhenPushed does nothing

Created on 14 Feb 2018  ·  5Comments  ·  Source: xamarin/Xamarin.Forms

Bug report best practices: https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues

Description

Migrating https://bugzilla.xamarin.com/show_bug.cgi?id=56072 here

I have a tabbed page with a page and a page in a navigation controller. On the page with the navigation controller, there is a button that will do a push to another page. When the page is pushed I want to remove the tab bar. And when the user hits back, I want the tab bar to reappear. The property HidesBottomBarWhenPushed on a UIViewController is supposed to do just that.

Setting that property in a Xamarin.ios project works perfectly, does exactly what it is supposed to do.

Setting the property in a custom renderer in a Xamarin.forms project does nothing, the tab bar won't disappear when the page is pushed.

Steps to Reproduce

  1. Run project, go to the second tab
  2. Press the button
  3. Note that the tab bar is still shown

Expected Behavior

The tabbar disappears when you use the button to navigate

Actual Behavior

The tabbar does not disappear

Basic Information

  • Version with issue: 2.5.0.122203
  • Last known good version: N/A
  • IDE: VS2017
  • Platform Target Frameworks:

    • iOS: yes

    • Android: does not apply

    • UWP: does not apply

  • Android Support Library Version:
  • Nuget Packages: just forms
  • Affected Devices: tested on iPhone 5s simulator running iOS 9.3

Reproduction Link

https://www.dropbox.com/s/0h9az4ybpag12tm/hidesbottombarwhenpushedxam.zip?dl=0
The attached zip has the Xamarin.ios project as well as the Xamarin forms project.

tabbedpage help wanted inactive iOS 🍎 proposal-accepted enhancement ➕ up-for-grabs

Most helpful comment

The way we wrap the Page inside another ViewController when pushing on UIViewControlelr will not allow this to work.

Thank you @rmarinho for this hint, as a workaround I'm now using a custom renderer (in Xamarin.Forms) with:

```c#
public override void DidMoveToParentViewController(UIViewController parent)
{
base.DidMoveToParentViewController(parent);

// hide bottom tabbar
parent.HidesBottomBarWhenPushed = true;

}
```

And it's working, however it leaves an extra transparent space at the bottom (with the height of the hidden tabbar) which I don't know how to remove. I think it might be caused by the child view not scaling up with the wrapper.

I'm neither a Xamarin nor an iOS dev expert, do you have any suggestions to resolve it?

Sorry for bothering and thanks in advance.

All 5 comments

The way we wrap the Page inside another ViewController when pushing on UIViewControlelr will not allow this to work.

This is could be done with a platform specific for iOS, i will set this as a enhancememnt

@rmarinho I suppose you mean updating ParentingViewController's property before pushing the page on the stack?

yeah that was the wrapper I was referring , but remember this is internal, we could change that ..

What did you mean by "we could change that"? You mean we could get rid of the wrapper, make it non-internal, or something else?

The way we wrap the Page inside another ViewController when pushing on UIViewControlelr will not allow this to work.

Thank you @rmarinho for this hint, as a workaround I'm now using a custom renderer (in Xamarin.Forms) with:

```c#
public override void DidMoveToParentViewController(UIViewController parent)
{
base.DidMoveToParentViewController(parent);

// hide bottom tabbar
parent.HidesBottomBarWhenPushed = true;

}
```

And it's working, however it leaves an extra transparent space at the bottom (with the height of the hidden tabbar) which I don't know how to remove. I think it might be caused by the child view not scaling up with the wrapper.

I'm neither a Xamarin nor an iOS dev expert, do you have any suggestions to resolve it?

Sorry for bothering and thanks in advance.

Was this page helpful?
0 / 5 - 0 ratings