UITabBar的隐藏与显示
来源:互联网 发布:百度云不限速版本mac 编辑:程序博客网 时间:2024/04/27 21:08
1.系统方法 self.hidesBottomBarWhenPushed = YES;
该方法存在一定缺陷,根据其名字可以发现,只有在push的时候才会生效,也就是说在UITabBarController和UINavigationController结合使用的时候能用。
2.第二种方法比较通用,原理也很简单。
修改 TabBar 的 subview 的 frame 就行了。其中,UITabBarController的subview 共有两个,一个叫 UITabBar,就是底下的那个 Bar;另一个叫UITranstionview,就是 Bar 上面的视图。这两个 view 下面还有其他的subview,这就不用去管它了。把UITabBar的 y 向下移49个单位,把UITranstionview 的 hight 加长 49 个单位。
1 - (void)hidesTabBar:(BOOL)hidden{ 2 3 4 [UIView beginAnimations:nil context:NULL]; 5 [UIView setAnimationDuration:0]; 6 7 for (UIView *view in self.tabBarController.view.subviews) { 8 if ([view isKindOfClass:[UITabBar class]]) { 9 if (hidden) {10 [view setFrame:CGRectMake(view.frame.origin.x, [UIScreen mainScreen].bounds.size.height, view.frame.size.width , view.frame.size.height)];11 12 }else{13 [view setFrame:CGRectMake(view.frame.origin.x, [UIScreen mainScreen].bounds.size.height - 49, view.frame.size.width, view.frame.size.height)];14 15 }16 }else{17 if([view isKindOfClass:NSClassFromString(@"UITransitionView")]){18 if (hidden) {19 [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, [UIScreen mainScreen].bounds.size.height)];20 21 }else{22 [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, [UIScreen mainScreen].bounds.size.height - 49 )];23 24 }25 }26 }27 }28 [UIView commitAnimations];29 30 }
0 0
- UITabBar的隐藏与显示
- iOS UITabBar的隐藏显示
- UITabBar动态的隐藏和显示
- iOS UITabBar的隐藏和显示
- UITabBar显示隐藏解决方案
- 关于UITabbar在push中隐藏与显示
- 关于UITabbar在push中隐藏与显示
- IOS中如何在多层界面之间显示与隐藏标签栏(UITabBar)
- IOS中如何在多层界面之间显示与隐藏标签栏(UITabBar)
- 隐藏UITabBar
- 隐藏 UITabBar
- 隐藏UITabBar
- UINavigationBar + UITabBar 隐藏Tarbar的具体使用
- iOS UITabbar隐藏的超简单方法
- iOS 隐藏单个页面的UITabBar
- 关于UITabBarController的UITabBar隐藏问题
- 【iOS_Development】添加/隐藏UITabBar右上角的小红点
- UITabBar,UINavigationBar的布局和隐藏问题
- HttpClient使用详解
- Android添加一个新的按键Key
- redis数据库结构设计
- java的日期时间处理自定义类
- wsgi (Python Web Server Gateway Interface) ******************
- UITabBar的隐藏与显示
- Itunes connect Safari上传截图无反应
- JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- 无锁队列的原理与实现
- 征服Redis
- Android应用中埋点监控的思考与设计
- TemplatePart作用
- navTab 刷新
- Eclipse上GIT插件EGIT使用