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

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

问题描述

在隐藏标签栏后,是否有任何方法显示标签栏?



有一个tabbar-nav结构。对于其中一个选项卡,我需要隐藏其第二级和第三级视图的选项卡栏。



来自Elements的示例代码在这里我不太适用。

$我找到了一个很好的实用的解决方案这个问题 - 使UITabBarController的视图比它需要更大,所以实际的UITabBar是剪辑由屏幕。



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

  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;

标签栏仍显示,但它在屏幕底部,隐。



这可能会对性能产生影响,如果它导致额外的剪辑,但到目前为止,它似乎工作。


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

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.

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

解决方案

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天全站免登陆