iOS9如何隐藏各种bar
转载自:http://www.cnblogs.com/aBigRoybot/articles/2234487.html
状态条StatusBar
1 [UIApplication sharedApplication].statusBarHidden = YES;
导航条NavigationBar
1 [self.navigationController setNavigationBarHidden:YES];
TabBar
方法1
1 [self.tabBarController.tabBar setHidden:YES];
这个方法有问题,虽然tabBar被隐藏了,但是那片区域变成了一片空白,无法被其他视图使用。
方法2
对于navigationController+tabBarController的结构,可以在push下一级的childController之前将childController的hidesBottomBarWhenPushed属性设为YES。
比如,可以在childController的初始化方法中做这件事,代码如下:

1 // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
2
3 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
4 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
5 if (self) {
6 // Custom initialization.
7 self.hidesBottomBarWhenPushed = YES;
8 }
9 return self;
10 }

方法3
http://www.azumi.cc/thread-539502-1-1.html

1 - (void)makeTabBarHidden:(BOOL)hide
2 {
3 if ( [self.tabBarController.view.subviews count] < 2 )
4 {
5 return;
6 }
7 UIView *contentView;
8
9 if ( [[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] )
10 {
11 contentView = [self.tabBarController.view.subviews objectAtIndex:1];
12 }
13 else
14 {
15 contentView = [self.tabBarController.view.subviews objectAtIndex:0];
16 }
17 // [UIView beginAnimations:@"TabbarHide" context:nil];
18 if ( hide )
19 {
20 contentView.frame = self.tabBarController.view.bounds;
21 }
22 else
23 {
24 contentView.frame = CGRectMake(self.tabBarController.view.bounds.origin.x,
25 self.tabBarController.view.bounds.origin.y,
26 self.tabBarController.view.bounds.size.width,
27 self.tabBarController.view.bounds.size.height - self.tabBarController.tabBar.frame.size.height);
28 }
29
30 self.tabBarController.tabBar.hidden = hide;
31 // [UIView commitAnimations];
32 }

时机

1 - (void)viewWillAppear:(BOOL)animated {
2 [self setFullScreen:YES];
3 }
4
5 - (void)viewWillDisappear:(BOOL)animated {
6 [self setFullScreen:NO];
7 }
8
9 - (void)setFullScreen:(BOOL)fullScreen {
10 // 状态条
11 [UIApplication sharedApplication].statusBarHidden = fullScreen;
12 // 导航条
13 [self.navigationController setNavigationBarHidden:fullScreen];
14 // tabBar的隐藏通过在初始化方法中设置hidesBottomBarWhenPushed属性来实现。
15 }
iOS9如何隐藏各种bar的更多相关文章
- iOS7下隐藏status bar的详细研究
info.plist文件中,View controller-based status bar appearance项设为YES,则View controller对status bar的设置优先级高于a ...
- 隐藏 Status Bar
iOS6和iOS7在隐藏 Status Bar 三种方式比较: Storyboard 界面上选中UIViewController,最右边Simulated Metrics找到 Status Bar 设 ...
- Android 全屏显示-隐藏Navigation Bar
Sumsung Galaxy Nexus 屏幕分辨率为 1280X 720,但通常的应用都会显示Navigation Bar(Back 键,Home 键等),如下图所示: 但我注意到Youtube应用 ...
- iOS 使用Method Swizzling隐藏Status Bar
在iOS 6中,隐藏Status Bar很的简单. // iOS 6及曾经,隐藏状态栏 [[UIApplication sharedApplication] setStatusBarHidden:YE ...
- ios7上隐藏status bar
在iOS7上 对于设置status bar 又有了点点的改变 1.对于 UIViewController 加入了动态改变 status bar style的方法 - (UIStatusBarStyle ...
- iOS7中彻底隐藏status bar
用Xcode5开发新游戏,发现在iOS7中按照以前的方法隐藏status bar失效了. 想要彻底隐藏status bar,需要在info.plist中添加新行“View controller-bas ...
- ios开发中如何隐藏各种bar
转载自http://www.cnblogs.com/lovecode/articles/2234557.html 状态条Status Bar [UIApplication sharedApplicat ...
- 解决iOS9下隐藏App返回按钮文字导致的诡异闪屏问题
问题的原因竟是一行代码导致的,这行代码的作用是隐藏App返回按钮的文字. 看看这有问题的代码: //将返回按钮的文字position设置不在屏幕上显示 [[UIBarButtonItem appear ...
- iOS 隐藏Status Bar
要隐藏,有3个地方要做: 1.在info.Plist里,将该属性的hidden,设置为YES,这样,在启动时,就不会显示了: 2.在application-didFinish里面写,这样,可以隐藏io ...
随机推荐
- 系统自动生成ID(比UUID.radom().tostring()要好看)
public class test1 { public static void main(String[] args) { char[] para = {'A','B','C','D','E','F' ...
- UNIX基础--安装应用程序: Packages 和 Ports
Packages and Ports 概述 FreeBSD 将许多系统工具捆绑作为基本系统的一部分.另外,FreeBSD 提供了两种补充的技术来安装第三方软件:FreeBSD Ports Collec ...
- Oracle新建实例后,修改sys和system密码。
sqlplus/nolog connect sys as sysdba alert user sys identified by pwd;
- matlab里plot设置线形和颜色
plot(x,y,'r--')% r为颜色,--为线形
- centos 设置删除提示
centos 设置删除.覆盖提示 相信好多用linux的同学都用过cp这个命令来覆盖文件,但是新建的普通用户不会有任何提示,这时候心里就咯噔一下,赶紧看看新文件的是不是传上去了.如果加上提示,是不是就 ...
- Linux服务器性能指标查询命令安装
Linux命令扫盲 之 sar 今天在读<大规模Web服务开发技术>一书的时候,书中提到了sar这个命令,感觉很有用,有必要整理学习一下.(对于一位Linux初学者,不能放过任何一个学 ...
- 用DriverBackUp备份了文件 装好系统后怎么把备份的驱动文件还原
1.打开DriverBackUp 2.菜单栏选择Restore 3.选择open backup file 4.找到备份文件位置,并选择.bki后缀的文件 5.点击"打开" 6.勾选 ...
- EF Codefirst 初步学习(二)—— 程序管理命令 更新数据库
前提:搭建成功codefirst相关代码,参见EF Codefirst 初步学习(一)--设置codefirst开发模式 具体需要注意点如下: 1.确保实体类库程序生成成功 2.确保实体表类库不缺少 ...
- JavaFX基础学习之OkHttp/Gson
导入jar包,使用OkHttp/Okio/Gson请求解析 package application; import java.io.IOException; import java.net.URL; ...
- Openlayer 3 最简单的弹出框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...