0

I have a settings dialog that I want to be full screen and cover the tab bar at the bottom of the screen. I used this SO answer and added HidesBottomBarWhenPushed to my view controller and it does hide the tab bar. Unfortunately it leaves behind the little triangle indicator subview that is displayed by the UITabBarController subclass.

enter image description here

I'm assuming there is some form of notification that I can subscribe to in order to hide the indicator but I don't know what that is. A little help here?

Community
  • 1
  • 1
David Clarke
  • 12,888
  • 9
  • 86
  • 116

2 Answers2

1

Maybe you could post a NSNotification when you set the bar to hidden using the method described here? Can't access TabBarController from ImageView

Community
  • 1
  • 1
Tony
  • 4,609
  • 2
  • 22
  • 32
0

I'm going to answer this myself because I think it's worth recording for future reference. I have a SettingsDialogViewController I wire up in the ViewDidLoad() method of my HomeDialogViewController:

NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Settings", UIBarButtonItemStyle.Plain, (e, sender) => {
    ActivateController (_settingsDvc());
});

The SettingsDialogViewController is created with HidesBottomBarWhenPushed = true. So when the settings dialog is activated, the bottom bar is hidden which causes the ViewWillLayoutSubviews() method of the CustomTabBarController to be called. By overriding that method I can set the visibility of my indicator based on whether the visible view controller (e.g. SettingsDialogViewController) hides the bottom bar when pushed. When that view controller is popped the indicator will automatically reappear.

public override void ViewWillLayoutSubviews () {
    base.ViewWillLayoutSubviews ();
    var selectedVc = SelectedViewController as UINavigationController;
    indicator.Hidden = selectedVc != null && selectedVc.VisibleViewController.HidesBottomBarWhenPushed;
}

A final note, I found that the animation that occurred when activating the new settings view would display a black band across the screen below the status bar. I resolved this by setting the AutoResizingMask in the "from" view controller.

public override void ViewDidLoad () {
    base.ViewDidLoad ();
    NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Settings", UIBarButtonItemStyle.Plain, (e, sender) => {
        ActivateController (_settingsDvc());
    });
    View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
}
David Clarke
  • 12,888
  • 9
  • 86
  • 116