Xamarin iOS: navigation bar not showing after pushing view

I have created all of my UI in code (since I use Flyout Navigation which doesn't seem to work with storyboards). I have a UINavigationController called MainController, and a series of view controllers. When I start up the app with the root controller, it displays the navigation bar just fine.

When I programmatically create a new ViewController called ArticleDisplay, I create and push it as such (within MainController):

public void Open_Article(Post post)
{
    ArticleDisplay vw = new ArticleDisplay(this);
    vw.SetPost(post); // to set the iOS

    this.PushViewController(vw, true);
}

When I run the app and display the ArticleDisplay controller, I don't get a navigation bar (as you can see in this image), although the main view controller has a navigation bar. Trying to do things like this.SetNavigationBarHidden(false,true) do nothing.

What do I do to get the navigation bar to display? I'm sure I'm screwing it up somewhere. I need it so I can allow the user to get back to the controller they were in before.

Answers


After looking into FlyoutNavigation it seems that it is possible to use a Storyboard

Try downloading the Sample project (as pointed out by Mohib Sheth) and create a push segment between the button and the second view.

Using the PushViewController method

If you still want to use the PushViewController method make sure that your initial view ( as shown after clicking on a FlyOutNavigation item ) is a NavigationController. This NavigationController will control the navigation stack for the current page.

Now that the ViewController is wrapped by a NavigationController you can add a button or just call the NavigationController.PushViewController method.

PushView.TouchDown += (evt, args) =>
{
    NavigationController.PushViewController(new UIViewController(), true);
};

I hope this helps!


Need Your Help

un-hiding a data-bound thing ( ng-model or {{food.foo}} ) breaks the binding

javascript angularjs angularjs-directive angularjs-scope

My problem: I can modify my model fine, and the changes are reflected in my view, as long as my view is hidden. As soon as my view is un-hidden, changes made to scope.food.foo from timeouts, event