tabbar controller
I have a view 开发者_开发问答based application in which at a later point of time I have to load a tabbar controller. Can any one please tell me how to do this. I tried adding uitabbar but doesnt seem to work.
Thanks
The better way is to take one UITabbarController in MainWindow.xib and bind it with your appDelegate's IBOutlet UITabbarController
[window addSubView:tabbarController.view];
[window addSubView:viewController.view];
Now make function
-(void)showTabBarController:(BOOL)bShown{
tabbarController.view.hidden = !bShown;
[window bringSubViewToFront:tabbarController.view];
}
Now call this function whenever necessary, For example, if you do not want tabbar at launching, you can hide it on didFinishLaunching by calling [self showTabBarController:FALSE];
and if you want to show tabbarcontroller at any view controller, you can unhide it by calling [appDelegate showTabBarController:TRUE];
Hope it helps
You can do this by using a normal tabbar, and then handling the tabbar call backs by making your view controller its delegate
精彩评论