当按下按钮以允许全屏查看内容时,是否可以隐藏标签栏? [英] Is it possible to hide the tabbar when a button is pressed to allow a full screen view of the content?

查看:24
本文介绍了当按下按钮以允许全屏查看内容时,是否可以隐藏标签栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的基于导航的应用程序的详细信息视图中有一个 UITabBar.我在 tableview 中存储文本和图像,并希望用户能够点击单元格以隐藏导航控制器和标签栏以全屏查看内容.

I have a UITabBar in the detail view of my navigation based application. I am storing text and images in a tableview and would like the user to be able to tap on a cell to hide the navigation controller and the tabbar for full screen viewing of the content.

我找到了隐藏顶部栏的代码,但隐藏标签栏似乎并不容易.

I found this code for hiding the top bars, but it does not seem as easy to hide the tabbar.

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
 [self.navigationController setNavigationBarHidden:YES animated:YES];

有人知道怎么做吗?

一旦视图已加载,此代码就无法隐藏 tabBar.

This code does not work to hide the tabBar once the view is already loaded.

  yourTabViewController.hidesBottomBarWhenPushed = YES;

<小时>

这是我找到的代码.似乎只有在加载视图时才有效,因此一旦它已经出现就不能用于隐藏标签栏.我仍在努力完成这项工作.请帮忙!!!


This is the code I found. Seems to only work when the view is loaded though, so it can't be used to hide the tabbar once it has already appeared. I'm still struggling to make this work. Please help!!!

    self.tabBarController.tabBar.hidden = YES;

推荐答案

我发现的最佳解决方法是更改​​视图大小,使其覆盖标签栏.这是我在选择一行时隐藏 statusBar、navBar 和 tabBar 的代码:

The best workaround I have found is to change the view size so that it covers the tabbar. Here's my code for hiding the statusBar, navBar, and tabBar when a row is selected:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

if (appDelegate.navigationController.navigationBar.hidden == NO)
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
    [appDelegate.navigationController setNavigationBarHidden:YES animated:YES];

    [UIView beginAnimations:@"HideTabbar" context:nil];
    [UIView setAnimationDuration:.2];
    self.view.frame = CGRectMake(0,0,320,480);
    [UIView commitAnimations];
}
if (appDelegate.navigationController.navigationBar.hidden == YES)
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
    [appDelegate.navigationController setNavigationBarHidden:NO animated:YES];

    [UIView beginAnimations:@"ShowTabbar" context:nil];
    [UIView setAnimationDuration:.2];
    self.view.frame = CGRectMake(0,0,320,368);
    [UIView commitAnimations];
}   
}

这篇关于当按下按钮以允许全屏查看内容时,是否可以隐藏标签栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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