Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change UITabBar Selected Tab

I have an app that I created as a Tab Bar Application, and there are 3 tabs (Home, Search, My Account). The Home view loads with some info and a search button. The search button then takes the user to the Search View, but since the user didn't select the tab the selected tab is still the Home tab. How do I change the selected tab from the Home to the Search once the Search viewDidLoad?

like image 318
Barrett Avatar asked Dec 03 '22 09:12

Barrett


1 Answers

Thanks for the help, You guys helped me in the right direction I ended up using the App delegate to access the UITabBarController. This is what it looked like.

 Motel_6AppDelegate *appDelegate = (Motel_6AppDelegate*) [[UIApplication sharedApplication] delegate];
    [appDelegate.rootController setSelectedIndex:1];
like image 91
Barrett Avatar answered Dec 11 '22 10:12

Barrett