I am using a UITabBar control from library in one of my view (note that I am not using UITabBarController but the UITabBar control).
Now, I am adding two tabBar items to this tabBar.
I have created controller class for this view (.m and .h) files and used delegates in the .h file.
In the .m file I have used the following function:
- (void)tabBar:(UITabBar *)TabBarControl didSelectItem:(UITabBarItem *)FirstView
I have assigned tag = 0 and tag = 1 to respective tabBar items.
What I want to do is that, on click of first tabBar item I want to show a view and click of another tabBar item, I want to show another view.
So, in the above function I am checking that if the tag of clicked tabBar item is 0 than I will show one view else I will show another view.
I am showing the view as following:
Team1Scoreboard *tempTeam1Scoreboard = [Team1Scoreboard alloc]; tempTeam1Scoreboard = [tempTeam1Scoreboard initWithNibName:@"UserTeamScoreboard" bundle:[NSBundle mainBundle]];
self.cntrlTeam1Scoreboard = tempTeam1Scoreboard;
[tempTeam1Scoreboard release];
UIView *theWindow = [self.view superview];
[self.view removeFromSuperview];
[theWindow addSubview:self.cntrlTeam1Scoreboard.view];
Now the problem is that, when I click on any of the tabBar item, it will load the correct view but the tabBar itself will be disappeared as I am adding the view to window itself.
Please help me so that I can load correct view and also my tabBar itself is visible.