2

I am using MvvmCross to create a MonoTouch application. I have followed the the basic tutorial, and so far so good. The only problem is that my (initial and so far only) view is displayed with a top bar/navigation bar, which I don't want. I am able to hide the navigation bar by calling

this.NavigationController.NavigationBarHidden = true;

in the view controller's ViewDidLoad. I would prefer to not have to suppress the navigation bar, but rather that it not be there at all. The fact that it is appearing is suggesting that perhaps I am doing something wrong/inheriting from the wrong base classes?

Further details on my code:

The view controller inherits from MvxBindingTouchViewController.

My Setup class inherits from MvxBaseTouchBindingSetup (I will not be using TouchDialog anywhere, so am not inheriting from MvxTouchDialogBindingSetup).

Any help would be greatly appreciated! If I need to supply more details on my code, please let me know.

Askolein
  • 3,250
  • 3
  • 28
  • 40
mrtnkrstn
  • 318
  • 5
  • 15

1 Answers1

1

The Navigation bar is part of the UINavigationController which is used in the default Presenter.

The Presenter is the thing that decides how a View (a UIViewController) is shown - whether it is displayed in a popup, displayed as a Modal view, pushed into a navigation controller, etc.

If you want to customise the Presenter - e.g. so that it hides the navigation bar - then just switch in your own implementation in your AppDelegate.cs where you find the code:

        // initialize app for single screen iPhone display
        var presenter = new MvxTouchViewPresenter(this, _window);
        var setup = new Setup(this, presenter);
        setup.Initialize();

You can see some examples of custom presenters in the TwitterSearch and Conference samples. TwitterSearch uses different presenters for phone vs tablet; and Conference uses a presenter which is aware of multiple tabs, each of which contains a NavigationController.

There are also a few other questions around on custom presenters like MvvmCross Using a modal ViewController from a Tab and why does MvxModalSupportTouchViewPresenter in MvvmCross only support one modal view

Community
  • 1
  • 1
Stuart
  • 66,722
  • 7
  • 114
  • 165