0

Inside my application I have LoginView and after that MainView which is MvxTabBarViewController with two tabs. Here is my code for MainView:

   public class MainView : MvxTabBarViewController<MainViewModel>
    {
        private bool _constructed;
        public MainView()
        {
            _constructed = true;

            // need this additional call to ViewDidLoad because UIkit creates the view before the C# hierarchy has been constructed
            ViewDidLoad();
        }

        public override void ViewDidLoad()
        {
            if (!_constructed)
                return;

            base.ViewDidLoad();



            Title = "SampleTabs";
            View.BackgroundColor = UIColor.Red;

            var viewControllers = new List<UIViewController>();
            viewControllers.Add(CreateTabFor("Second", ViewModel.TabEvents, 0));
            viewControllers.Add(CreateTabFor("First", ViewModel.TabDashboard, 1));


            ViewControllers = viewControllers.ToArray();
            CustomizableViewControllers = new UIViewController[] { };


         //   SelectedViewController = ViewControllers[1];
        }

        private UIViewController CreateTabFor(string title, IMvxViewModel viewModel, int index)
        {

            var controller = new UINavigationController();

            var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
            screen.Title = title;




            // screen.TabBarItem = new UITabBarItem(title, null, index);



            screen.TabBarItem = new UITabBarItem(UITabBarSystemItem.Search, index);


          controller.PushViewController(screen, false);  
           controller.NavigationBarHidden = true;

            return controller;
        }
    }

Problem is with tab items, I can't change it to second after initial tab is showed. Tabs are simple with only background color change. Any help is welcome.

iki93
  • 21
  • 6

1 Answers1

0

Fixed! Problem was with core core not with tab view.

iki93
  • 21
  • 6