Reputation: 3473
I had added tabbar dynamically in my application which is having 3tabs. Now these 3tabs open the specific view controller:-
1st Tab open:-Information page
2nd Tab open:-Some List page
3rd Tab open:-Setting page
Now on selecting the 3rd tab setting page appears In Setting page i have a button which navigate the application to some detailsettingpage. Now in detail setting page on clicking changebutton It will change the viewcontrollers of tab.:-
1st Tab open:-Information page
2nd Tab open:-Map Page(Instead of some list page)
3rd Tab open:-Setting page**
This is where the problem is.I am not having any clue to change the viewcontroller of 2nd tab which is already set once.
i had added the tabbar dynamically in viewwillappear() function of someviewcontoller.m filelike:-
tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:nav1,nav2,nav3,nil]];
[self.navigationController pushViewController:tabBarController animated:YES];
[nav1 release]; nav1 = nil;
[nav2 release]; nav2 = nil;
[nav3 release]; nav3 = nil;
[tabBarController release];
tabBarController = nil;
Upvotes: 2
Views: 419
Reputation: 1545
Try this! nav1,nav2,nav3 are navigationController's object. You must be using ViewController to pass in each navigationcontroller. So you need to change the viewController in nav2. Change object of nav2's viewcontroller from Some List page's View Controller to Map Page View Controller's object.
changing the object of view Controller will change the Tab button dynamically. hope it may help you.
Thanks :)
Upvotes: 2