简体   繁体   English

标签栏 controller

[英]tabbar controller

I have a view based application in which at a later point of time I have to load a tabbar controller.我有一个基于视图的应用程序,稍后我必须加载一个标签栏 controller。 Can any one please tell me how to do this.谁能告诉我如何做到这一点。 I tried adding uitabbar but doesnt seem to work.我尝试添加 uitabbar 但似乎不起作用。

Thanks谢谢

在此处输入图像描述

The better way is to take one UITabbarController in MainWindow.xib and bind it with your appDelegate's IBOutlet UITabbarController更好的方法是在 MainWindow.xib 中取一个 UITabbarController 并将其与您的 appDelegate 的 IBOutlet UITabbarController 绑定

[window addSubView:tabbarController.view];
[window addSubView:viewController.view];

Now make function现在制作 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];现在在必要时调用此 function,例如,如果您不想在启动时使用 tabbar,则可以通过调用 [self showTabBarController:FALSE] 将其隐藏在 didFinishLaunching 上;

and if you want to show tabbarcontroller at any view controller, you can unhide it by calling [appDelegate showTabBarController:TRUE];如果您想在任何视图 controller 中显示 tabbarcontroller,您可以通过调用 [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您可以通过使用普通标签栏来执行此操作,然后通过将您的视图 controller 设为其委托来处理标签栏回调

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM