Reputation: 9796
I am having trouble reloading the tabs in a tab bar and then having the correct tab selected.
When a user chooses a particular function in my app - this means I need to reload the tab bar at the bottom of the screen - and sometimes add buttons and other times remove.
I am able to reload the data using:
[self.tabBarController setViewControllers:controllers animated:YES];
but I can't get the selectedViewIndex to work propery it just seems to get ignored:
self.tabBarController.selectedIndex = [controllers count]-1;
I want to have the last tab selected - but after this code has run it is always the first tab that is selected - Any ideas?
Upvotes: 0
Views: 3855
Reputation: 9796
I have found a way to do this now by issuing a
[self.tabBarController.view setNeedsDisplay];
after the call to selectedIndex - but the problem is that the screen flashes and the animation is not very nice - any other ideas?
Upvotes: 1