1

I've got an iOS App with a TabBarController in the MainStoryboard. The Tab Bar works fine but I have 5 Tabs, and now the Tab which is selected by default is the first one, but I want the middle one (in that case the 3rd --> Index:2) to be selected by default.

I've found an answer here on stackoverflow (Setting the default tab when using storyboards), but for some reason its not working for me. How can I manage that instead?

Thank you in Advance!

Swift Dev Journal
  • 19,282
  • 4
  • 56
  • 66
Markus
  • 13
  • 2

1 Answers1

0

set the selectedIndex of the tabBarController.

 var Launching = true
    override func viewWillAppear(animated: Bool) {
         if Launching == true {
             Launching = false
             self.tabBarController.selectedIndex = 2 // 3th tab
         }
    }

I hope it will works for you ... :)

Shivam Parmar
  • 1,520
  • 11
  • 27