adding tabbar to uiview (not tabbarcontroller) to switch views
- by Pavan
Hi,
i added a Tab bar to my existing view called secondViewController where there are now 4 tab bar items using interface builder. This tab bar will allow the users to switch between views.
This is what ive tried to do:
If i use a tabbar controller, then a new view pops up and i dont want that. i simply want to be able to add a tab bar as ive done and carry on from there.
i dont know how to actually connect it all up and make everything work together.
This is what i understand:
i have to make my current - secondViewController an tabbardelegate which is what ive done as shown
@interface paddedDholViewController : UIViewController <AVAudioPlayerDelegate, UITabBarDelegate> {
}
then i understand that i have to add
tabBar.delegate = self;
for me to be able to detect the tabBar:didSelectItem:
so i can then implement something like this
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if ([viewController.tabBarItem.title isEqualToString:@"FIRST"])
{
NSLog(@"FIRST");
} else if ([viewController.tabBarItem.title isEqualToString:@"SECOND"])
{
NSLog(@"SECOND");
}
}
to be able to switch between the views
The thing is as ive said before i dont know how to implement all of this and how to connect everything up.
can someone help me please.
Thank you in advance