How to change selected tab index

My application has a tab bar. On one of the tab items (for example, the item in index 1 on the tab) there are several buttons when you click on them that will appear on some pages that are under some other tab bar item (for example, the item with index 3 on the tab) .

I was able to go to the right page, but the tab selection does not display properly. Although the page is in an element of the 3rd tab bar, the 1st element is selected.

How to solve this? Ideas plz

+3
source share
1 answer

Finally, I got a solution.

, , , - , . nib, .

:

, , self.navigationcontoller, .

TabViewController *tabBarController = [[TabViewController alloc]
                                                initWithNibName:GENERIC_TAB_NIB 
                                                bundle:nil];

DetailsViewController *detailsVC = [[DetailsViewController alloc]  initWithNibName:DETAILS_NIB
                                                         bundle:nil];
        UINavigationController *navigationController = (UINavigationController *)[tabBarController.viewControllers objectAtIndex:1];
        [navigationController pushViewController:detailsVC animated:YES];
        [detailsVC release];
+1

Source: https://habr.com/ru/post/1786087/


All Articles