SpokaneDude
SpokaneDude

Reputation: 4984

How to programmatically change views in TabBarViewController?

I have two instances where I want to re-direct the user to the main view of a TabBarViewController. I've tried BringSubViewToFront(), but that does nothing... I basically want to activate the first tab (home tab?).

Upvotes: 1

Views: 1196

Answers (1)

Eduardo Scoz
Eduardo Scoz

Reputation: 24753

Assuming your TabViewController already has all the ViewControllers created for each tab, simply changing the SelectedIndex property in the tabbar does what you're looking for:

myTabBarController.SelectedIndex = 2;

Will send you to the third tab (array is zero-based).

Upvotes: 4

Related Questions