Basically what I have is View with a series of UIButtons
and depending on what button is pressed a View with UITabBar
is displayed with a certain UITabBarItem
selected.
This works out fine, however what I want to do is to change the UIView
within the UITabBarItem
.
So for example: I have 8 buttons on the my first view. I press button 1 and UITabBarItem
2 is selected and View A is displayed, however if I press button 2 UITabBarItem
2 is selected but instead of View A it displays View B.
What exactly is happening is, if I have viewDidLoad
method the code within is preloaded before I can change it dynamically. So I tried using viewWillAppear
but nothing seems to happen.
Any help will be appreciated. I hope I have made my question clear enough for everyone.
Asked
Active
Viewed 356 times
0

Mush
- 185
- 1
- 2
- 12
1 Answers
0
try to implement the uitabbarcontroller protocol and overwrite these methods:
– tabBarController:shouldSelectViewController:
– tabBarController:didSelectViewController:

frx08
- 4,222
- 8
- 37
- 45
-
Thanks for that, however I have realized this are more complex than that. – Mush Jul 31 '11 at 10:50
-
Maybe I should have mentioned that on top of the UITabBarController I actually have a series of UIButtons which act as a custom UITabBar. so once a button is press it is not detected by any of the methods. Is there a way around this? – Mush Jul 31 '11 at 11:02
-
in my opinion you have to link that button to a custom selector on the tap event and then call manually the protocol methods – frx08 Aug 01 '11 at 09:58