Search code examples
xamarin.iosuitabbarcontrollertitletitlebar

Show Title in MonoTouch tabbed application


Maybe I'm missing something super simple, but I can't seem to get a title to show up at the top of Views contained within a basic tabbed application. I follow these steps...

  1. New Solution, Universal Storyboard, Tabbed Application
  2. Run that and you have two basic Views "First View" and "Second View".
  3. Neither View by default has a title bar, but the default code shows setting a this.Title.

Why don't the title bars show up? How do I get them to show? I've tried several things to get these to show such as...

  1. Setting "Top Bar" in Interface Builder to "Navigation Bar". It then shows in Interface Builder but never shows on runtime.
  2. I've also tried in ViewDidLoad() to set this.TabBarController.Title but that doesn't seem to do anything either.

Thoughts?


Solution

  • The feature you are looking for is called a NavigationBar and can be added manually via IB to your view if it does not have a NavigationController associated with it. If there is a navigation controller then the NavigationBar will show up automatically.

    So to answer your question if you want a NavigationBar go to IB and add one from the objects library you should then be able to manipulate the Title on the nav bar to your hearts content.