used TabBarcontroller.selectedIndex to switch between Tabs.