如何在需要的地方显示和隐藏标签栏?
您好,我正在制作一个应用程序,其中有从 1 到 4 的四个屏幕(视图控制器)。我想显示没有选项卡栏的屏幕 1。该屏幕将具有三个按钮,用户可以通过它们导航到其他屏幕。现在,当用户点击屏幕 2 按钮时,用户应导航到底部带有选项卡栏的屏幕 2。现在,此选项卡栏将有从屏幕 1 到屏幕 4 的四个选项卡进行导航。同样,当用户现在点击选项卡 1 时,屏幕 1 应该到达这是没有标签栏等。 我的问题是我无法在所需的位置加载或卸载选项卡栏。我尝试过以下操作:
- 我在 statrt up 上打开屏幕 1,并且在屏幕 1 的视图上确实加载了选项卡栏,但它不起作用
我添加了选项卡主窗口上的栏,但标签栏甚至开始显示在屏幕 1 上。
请告诉我执行此操作的正确方法(换句话说,带有四个选项卡的选项卡栏,其中第一个屏幕不应显示选项卡栏)
提前致谢
Hi i am making an application where ther are four screens(view controllers) from 1 to 4. I want to show screen 1 without tab bar .This screen will have three buttons through which user can navigate to other screens. Now when user taps screen 2 button then user should navigate to screen 2 with tab bar on bottom.Now this tab bar will have four tabs from screen 1 to 4 to navigate .Similarly when now user tap on tab 1 then the scrren 1 should arrive which is without tab bar and so on.
My problem is i am not able to load or unload tab bar at required places.I have tried following:
- I opened screen 1 on statrt up and on screen 1's view did load added the tab bar but it didnt work
I added tab bar on main window but then tab bar starts to show even on screen 1.
PLease tell me the correct way to do this (In other words a tab bar with four tabs in which the first screen should not show tab bar)
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用这一行
隐藏标签栏。在推送您想要隐藏选项卡栏的页面之前使用此命令,并
在您要推送
viewWillDisappear
的同一页面上写入此行。use this single line
for hide tab bar. use this before push the page where you want tab Bar hidden and also write this line
at same page from where you are going to push in
viewWillDisappear
.首先在窗口中添加 rootviewcontroller。
并在其中添加三个按钮。
在按钮的单击事件上将 tabbarcontroller 添加到主窗口
First add your rootviewcontroller in the window.
and add three buttons in it.
on clicking event of button add tabbarcontroller to mainwindow