如何在基于视图/选项卡栏的应用程序中隐藏选项卡栏
我正在开发一个简单的基于视图的 iPhone 应用程序。 从应用程序的主屏幕,您可以导航到 4 个不同的视图。 这些视图之一包含一个选项卡栏。 因为这不是正常方法,所以我使用了没有 UITabController 的解决方法。
为了实现这一点,我利用了这个主题: https://discussions.apple.com/thread/2099944?start=0& ;tstart=0
这个示例代码: http://pymbian.svn.sourceforge.net/svnroot/pymbian/ stuff/testtab_raynewbie/Classes/
通过一些小的修改就可以了。 只有当我想从选项卡式视图返回主视图时,我有最后一个错误,选项卡栏保留在屏幕底部。
我尝试了这里描述的几种方法。
myTabBar.hidden = YES
hidesBottomBarWhenPushed = YES
但似乎没有一个起作用...... 我认为问题出在视图 UI 控制器的奇怪结构中。因为现在的结构是这样的。
MainViewController
- ViewController with TabBar
- tab1viewcontroller
- tab2viewcontroller
- other viewcontrollers
返回主视图是在 tab1viewcontroller 中完成的,我无法对 TabBar 执行任何操作。在所有其他视图中,我都会返回以下代码:
-(IBAction) BackAction:(id)sender {
mainControllerView = [[MainControllerView alloc] initWithNibName:@"MainControllerView" bundle:nil];
[self.view addSubview:mainControllerView.view];
[mainControllerView.view release];
}
有人有想法吗?
I'm working at a simple view-based iPhone application.
From the main screen of the App you can navigate to 4 different views.
One of these views consists of a tab bar.
Because this is not the normal approach I used a workaround without a UITabController.
To accomplish this I made use of this topic:
https://discussions.apple.com/thread/2099944?start=0&tstart=0
And this example code:
http://pymbian.svn.sourceforge.net/svnroot/pymbian/stuff/testtab_raynewbie/Classes/
With some small modifications this works.
Only I have one last bug when I want to return to the home view from the tabbed view, the tab bar stays in the bottom of the screen.
I tried several approaches described here.
myTabBar.hidden = YES
hidesBottomBarWhenPushed = YES
But none seem to work....
I think the problem is somewhere in the strange structure of views UI controllers. Because now the structure looks like this.
MainViewController
- ViewController with TabBar
- tab1viewcontroller
- tab2viewcontroller
- other viewcontrollers
And going back to the main view is done in the tab1viewcontroller where I can't do anything to the TabBar. In all the other views I go back with this code:
-(IBAction) BackAction:(id)sender {
mainControllerView = [[MainControllerView alloc] initWithNibName:@"MainControllerView" bundle:nil];
[self.view addSubview:mainControllerView.view];
[mainControllerView.view release];
}
Anyone an idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从上一个视图推送时,您需要隐藏选项卡栏。
LoginViewController
是不需要标签栏时要推送的视图。 :)You need to hide the tab bar when pushed from previous view.
LoginViewController
is the view to be pushed where tab bar is not required. :)尝试在要隐藏选项卡栏的视图控制器中执行以下
代码
Try following code in view-controller where you want to hide tabbar
and