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;
}