iOS之隐藏/显示tabbar
2016-03-31 15:49
543 查看
func setTabBarHidden(flag:Bool!){ //将view的frame放大到全屏,就把TabBar变相隐藏了,不会出现黑色区域。 if UIApplication.sharedApplication().keyWindow?.rootViewController?.isKindOfClass(UITabBarController.self) == true{ let tabVC : UITabBarController = UIApplication.sharedApplication().keyWindow?.rootViewController as! UITabBarController // if tabVC.tabBar.hidden != flag{ debugPrint("UITabBarController hidden \(tabVC.tabBar.hidden)") let tab = tabVC.view//self.tabBarController?.view if tab?.subviews.count < 2 { return } var tmpView : UIView! if tab?.subviews[0].isKindOfClass(UITabBar.self) == true { tmpView = tab?.subviews[1] }else{ tmpView = tab?.subviews[0] } if flag == true{ tmpView.frame = (tab?.bounds)! tmpView.frame = CGRectMake(tmpView.bounds.origin.x, tmpView.bounds.origin.y, tmpView.bounds.size.width, tmpView.bounds.size.height + self.tabBarController!.tabBar.frame.size.height); }else{ tmpView.frame = CGRectMake((tab?.bounds.origin.x)!, (tab?.bounds.origin.y)!, (tab?.bounds.size.width)!, (tab?.bounds.size.height)!) } debugPrint("UITabBarController tmpView \(tmpView)") // tabVC.view.backgroundColor = UIColor.whiteColor() tabVC.tabBar.hidden = flag } //} }
相关文章推荐
- IOS折线统计图
- iOS 地图定位
- 关于iOS多线程,你看我就够了
- iOS性能优化的25条建议
- MMDrawerController(0.6.0) 文档翻译(简介,非API文档)
- 使用mjrefresh遇到的坑爹bug
- 搜索时将空格去除iOS
- AsyncLoadLocalImage ios 加载本地高清大图
- iOS开发中地图开发的简单应用
- 利用iOS8新特性计算cell的实际高度
- Xu Hao、Chen Xiaobo:自己手动发现iOS内核缺陷
- iOS-创建单例模式
- ios 高性能方法调用优化(IMP)
- iOS for循环创建button,button的宽度根据上面的文字来自适应.(自适应宽度且自动换)
- ios自带地图笔记
- 类似美团的iOS地图定位及调用苹果系统导航
- iOS创建与使用静态库
- ios: XcodeColors插件输出颜色不变
- iOS开发--cocoaPods使用详细说明(转载他人)
- IOS 中的 _cmd 代表本方法的名称