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 ...
随机推荐
- hdu 3480 Division(斜率优化DP)
题目链接:hdu 3480 Division 题意: 给你一个有n个数的集合S,现在让你选出m个子集合,使这m个子集合并起来为S,并且每个集合的(max-min)2 之和要最小. 题解: 运用贪心的思 ...
- 《Intel汇编第5版》 汇编逆转字符串
一.逆转字符串 逆转一个字符串可以利用栈这个数据结果,顺次读取所有元素压栈,再出栈所有元素即可逆序 二.push和pop指令 三.pushfd和popfd 四.pushad和popad 五.代码以及结 ...
- php笔记(二)PHP类和对象之Static静态关键字
PHP类和对象之Static静态关键字 静态属性与方法可以在不实例化类的情况下调用,直接使用类名::方法名的方式进行调用.静态属性不允许对象使用->操作符调用. class Car { pr ...
- UEFI主板GPT方式安装CentOS6.4
1. 设置BIOS:禁用CSM,禁用安全启动: 或不用禁用CSM,但以EFI方式安装系统: 2. 使用Diskgen或类似工具把硬盘格式为GPT格式(可以建立多于4个的主分区了): 3. 官 ...
- Quartz简单实例
Quartz中提供了两种触发器,分别是CronTrigger和SimpleTrigger. 1. SimpleTrigger 每隔若干毫秒来触发纳入进度的任务. 2. CronTrigger 在特定& ...
- 设置session存储在int sqlserver上---使用aspnet_regsql.exe工具
以管理员身份打开命令窗 1)cd到相应的framework下,如:C:\Windows\Microsoft.NET\Framework\v4.0.30319 2)执行如下命令:aspnet_regsq ...
- selenium1,selenium2,watir的比较
接触web方面的自动化测试,会接触几个常用的工具,selenium1,selenium2,watir 有的时候总是混淆,那么他们的优缺点啥的呢,在让你给项目选自动化框架,会选择哪个??? 1,语言的支 ...
- ajax请求相关方法
jquery的ajax请求相关方法有多个: 1.$.ajax() 示例: <!DOCTYPE html> <html> <head> <meta charse ...
- android自定义控件(理论知识学习 +自定义属性的讲解)
View树和UI界面架构图 UI界面架构图: android视图最外层是一个window对象. phoneWindow来实现. phoneWindow将一个decorView作为整个布局的根vie ...
- qml 中 使用 shader
使用绘制工具如Photoshop .Flash已经可以创建许多效果非常绚丽的图像.动画等. Qt/QML 的努力其实是在这些工具发展的后面, 因此很多效果在Qt中无法实现. 不得不佩服Qt小组的才智, ...