隐藏UITabBarController中的顶部栏 [英] Hide the top bar in UITabBarController

查看:174
本文介绍了隐藏UITabBarController中的顶部栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用OBJ-C代码(不使用Interface Builder)在UITabBarController中隐藏顶部栏?

How do I hide the top bar in UITabBarController using OBJ-C code (without using Interface Builder) ?

请查看以下链接中的图像,以更好地了解我的要求.

Please see the image in the link below to better understand my requirement.

http://skitch.com/jugsvn/dxkr7/iphone-simulator

您已经看到,我已经有了另一个工具栏,我不想要这样.我没有使用XIB/NIB文件,而是使用普通的OBJ-C代码创建了所有对象.

I already have another toolbar as you can see and I don't want this. I'm not using XIB / NIB files and creating all the objects using plain OBJ-C code.

欢呼 水壶

推荐答案

topBar是UINavigationController的一部分,而不是UITabBarController的一部分,您可以通过将以下内容放在viewWillAppear方法中来隐藏它:

The topBar is part of the UINavigationController not the UITabBarController, you can hide it by putting the following in your viewWillAppear method:

self.navigationController.navigationBarHidden = YES;

但是我很确定NavigationBar始终在顶部,因此我认为您要隐藏的栏实际上是您自己的工具栏.

But I'm pretty sure the navigationBar is always on top, so I think the bar you want to hide is actually your own toolbar.

self.myToolBar.hidden = YES;

这篇关于隐藏UITabBarController中的顶部栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆