gpt4 book ai didi

iphone+在推送任何 View 时隐藏标签栏

转载 作者:行者123 更新时间:2023-11-29 04:42:49 25 4
gpt4 key购买 nike

我正在设计一个应用程序,它在选项卡栏中有超过4个选项,所以我想做的就是在推送任何 View 时隐藏选项卡栏,并在弹出 View 时再次显示它,我尝试了 hidesbottomwhenpushed 但没有'不为我工作。请帮忙

最佳答案

使用此功能

- (void) hideTabBar:(UITabBarController *) tabbarcontroller 
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}

}

[UIView commitAnimations];

}

当你调用这个函数时

[self hideTabBar:self. tabbarcontroller];

当你想显示 tabbarcontroller 时使用这个函数

 - (void) showTabBar:(UITabBarController *) tabbarcontroller {

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    for(UIView *view in tabbarcontroller.view.subviews)
    {
        NSLog(@"%@", view);

        if([view isKindOfClass:[UITabBar class]])
        {
            [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];

        }
        else
        {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
        }


    }

    [UIView commitAnimations];
}

关于iphone+在推送任何 View 时隐藏标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10106017/

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