gpt4 book ai didi

ios - 在 iOS 6 中隐藏 TabBar

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:02:27 24 4
gpt4 key购买 nike

我想在 iOS 6 中隐藏我的 TabBar,当我编写下面给出的代码时,它在 iOS 7 中工作,但它在 中显示黑线iOS 6

self.tabBarController.tabBar.hidden = YES;

这是 iOS 6 的快照

:

最佳答案

尝试使用以下代码可能会对您有所帮助...

- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
if([UIScreen mainScreen].bounds.size.height==568)
{
[view setFrame:CGRectMake(view.frame.origin.x, 568 +20, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, 480+20, view.frame.size.width, view.frame.size.height)];
}

}
else
{
if([UIScreen mainScreen].bounds.size.height==568)
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 568)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}
}
}
}

- (void)showTabBar:(UITabBarController *) tabbarcontroller
{
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
if([UIScreen mainScreen].bounds.size.height==568)
{
[view setFrame:CGRectMake(view.frame.origin.x, 519, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
}
}
else
{
if([UIScreen mainScreen].bounds.size.height==568)
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 519)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
}
}
}
}

关于ios - 在 iOS 6 中隐藏 TabBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20368589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com