pa12
pa12

Reputation: 1503

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

Upvotes: 0

Views: 388

Answers (2)

jigneshbrahmkhatri
jigneshbrahmkhatri

Reputation: 3637

enter image description here

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

Upvotes: 1

SeriousSam
SeriousSam

Reputation: 229

You can do this by using a normal tabbar, and then handling the tabbar call backs by making your view controller its delegate

Upvotes: 0

Related Questions