在隐藏后显示标签栏 [英] Show tab bar after its hidden

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

问题描述

标签栏隐藏后有什么办法可以显示吗?

Is there any way to show a tab bar after it has been hidden?

有一个 tabbar-nav 结构.对于其中一个选项卡,我需要隐藏其第 2 级和第 3 级视图的选项卡栏.但同时我需要显示它的第一个和第四个视图.

Got a tabbar-nav structure. For one of the tabs, I need to hide the tab bar for its 2nd and 3rd level view. But at the same time I will need to show its 1st and 4th view.

我认为 Elements 的示例代码在这里并不适用.

The sample code from Elements isn't really applicable here I think.

推荐答案

我找到了一个很好的实用解决方案来解决这个问题——让 UITabBarController 的视图比它需要的更大,这样实际的 UITabBar 就会被屏幕.

I've found quite a good pragmatic solution to this problem - make the UITabBarController's view larger than it needs to be, so that the actual UITabBar is clipped by the screen.

假设标签栏视图通常填充其超视图,这种事情应该可以工作:

Assuming that the tab bar view normally fills its superview, this sort of thing should work:

CGRect frame = self.tabBarController.view.superview.frame;
if (isHidden)
{
    CGFloat offset = self.tabBarController.tabBar.frame.size.height;
    frame.size.height += offset;
}
self.tabBarController.view.frame = frame;

标签栏仍在显示,但它不在屏幕底部,因此似乎已被隐藏.

The tab bar is still showing, but it's off the bottom of the screen, so appears to have been hidden.

如果它导致额外的剪切,它可能会影响性能,但到目前为止,它似乎有效.

It might have performance implications if it causes extra clipping, but so far, it seems to work.

这篇关于在隐藏后显示标签栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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