Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:40:30+00:00 2026-06-05T14:40:30+00:00

I’m attempting to create a UITabBarController which implements a UINavigationBar, something I’d do in

  • 0

I’m attempting to create a UITabBarController which implements a UINavigationBar, something I’d do in Xcode in a matter of minutes. However, I’m struggling using MVVMCross with MonoTouch. Some of the code is below –

From the first VC (this is for the user to accept terms & conditions, so once accepted, there’s no option to go back to it, hence the true flag) –

this.RequestNavigate<TabHostViewModel>(true);

My tabBar is set up like so, which works fine –

ViewControllers = new UIViewController[]
{
    CreateTabFor("Home", "", ViewModel.homeViewModel),
    CreateTabFor("History", "", ViewModel.journeyHistoryViewModel),
    CreateTabFor("Contacts", "", ViewModel.contactsViewModel),
    CreateTabFor("About", "", ViewModel.aboutViewModel),
};

…etc.

I try to set up the first view (HomeView in this case) like so in ViewDidLoad –

this.NavigationController.NavigationBar.TintColor = myNavBarColour;

However, it seems that NavigationController in undefined, unless I create my own when I set up the TabBar –

UIViewController HomeViewController = CreateTabFor("Home", "", ViewModel.homeViewModel);
UINavigationController HomeNavController = new UINavigationController(HomeViewController);

ViewControllers = new UIViewController[]
{
    HomeNavController,
    CreateTabFor("History", "", ViewModel.journeyHistoryViewModel),
    CreateTabFor("Contacts", "", ViewModel.contactsViewModel),
    CreateTabFor("About", "", ViewModel.aboutViewModel),
};

Now I can do whatever I like with the navigation bar, but the trouble is I have two navigation bars, one at the top with no title, and the new one I’ve just created immediately below it.

Anyone with any thoughts?

Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:40:33+00:00Added an answer on June 5, 2026 at 2:40 pm

    I’m not entirely clear on your setup.

    However, I think what you are looking for is what the conference sample does

    • http://slodge.blogspot.co.uk/2012/03/update-on-mvvmcross-sqlbits-conference.html
    • https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CirriousConference

    Within this sample:

    • the home view hosts the tabbar
    • each tab has its own embedded NavigationController
    • each subview is hosted inside one of the navigation controllers

    This code is:

        private UIViewController CreateTabFor(string title, string imageName, IMvxViewModel viewModel)
        {
            var controller = new UINavigationController();
            controller.NavigationBar.TintColor = UIColor.Black;
            var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
            SetTitleAndTabBarItem(screen, title, imageName);
            controller.PushViewController(screen, false);
            return controller;
        }
    
        private void SetTitleAndTabBarItem(UIViewController screen, string title, string imageName)
        {
            screen.Title = ViewModel.TextSource.GetText(title);
            screen.TabBarItem = new UITabBarItem(title, UIImage.FromBundle("Images/Tabs/" + imageName + ".png"),
                                                 _createdSoFarCount);
            _createdSoFarCount++;
        }
    
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
    
            if (ViewModel == null)
            {
                _needViewDidLoadCall = true;
                return;
            }
    
            _needViewDidLoadCall = false;
    
            var viewControllers = new UIViewController[]
                                  {
                                    CreateTabFor("Welcome", "home", ViewModel.Welcome),
                                    CreateTabFor("Sessions", "sessions", ViewModel.Sessions),
                                    CreateTabFor("Favorites", "favorites", ViewModel.Favorites),
                                    CreateTabFor("Tweets", "twitter", ViewModel.Twitter),
                                  };
            ViewControllers = viewControllers;
            CustomizableViewControllers = new UIViewController[] { };
            SelectedViewController = ViewControllers[0];
        }
    

    The navigation is then intercepted inside the Presenter logic (configured in the AppDelegate) – the ConferencePresenter defers the ShowView logic to:

        public bool ShowView(IMvxTouchView view)
        {
            if (TryShowViewInCurrentTab(view))
                return true;
    
            return false;
        }
    
        private bool TryShowViewInCurrentTab(IMvxTouchView view)
        {
            var navigationController = (UINavigationController)this.SelectedViewController;
            navigationController.PushViewController((UIViewController)view, true);
            return true;
        }
    

    This logic is a little complicated, but the aim of this navigation and presenter design is to allow you to customise the presentation to suit the application. This can also be changed dynamically at runtime – so you can, for example, choose to use different presentation logic on a iPad instead of a iPhone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.