隐藏UITabbarController
来源:互联网 发布:杨幂爱的供养 知乎 编辑:程序博客网 时间:2024/05/20 23:32
平时我们需要自定义UITabBarController,则需要隐藏系统自带的.
如果使用
[self.tabBarController.tabBarsetHidden:YES];
这个方法就会有个问题-出现白条。
那么就需要我们为UITabBarController添加一个类别
@interface UITabBarController (HideTabBar)
在.h里面添加两个方法:
+(void)hidden:(UITabBarController *)tabbarcontroller isHidden:(BOOL)hidden;
+(void)hiddenTabBar:(UITabBarController *)tabbarcontroller animated:(BOOL)animated isHidden:(BOOL)isHidden
;
在.m文件里实现两个方法:
+(void)hidden:(UITabBarController *)tabbarcontroller isHidden:(BOOL)hidden
{
CGRect frame=[UIScreenmainScreen].bounds;
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBarclass]])
{
if (hidden)
{
[viewsetFrame:CGRectMake(view.frame.origin.x, frame.size.height+16, view.frame.size.width, view.frame.size.height)];
}
else
{
[viewsetFrame:CGRectMake(view.frame.origin.x, frame.size.height-49, view.frame.size.width, view.frame.size.height)];
}
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, frame.size.height)];
}
}
}
+(void)hiddenTabBar:(UITabBarController *)tabbarcontroller animated:(BOOL)animated isHidden:(BOOL)isHidden
{
if (animated) {
[UIViewbeginAnimations:nilcontext:NULL];
[UIViewsetAnimationDuration:0.3];
[selfhidden:tabbarcontroller isHidden:isHidden];
[UIViewcommitAnimations];
}
else{
[selfhidden:tabbarcontroller isHidden:isHidden];
}
}
#import"UITabBarController+HideTabBar.h"
在代码行使用类方法调用[UITabBarControllerhiddenTabBar:self.tabBarControlleranimated:YESisHidden:NO];
- UITabBarController 隐藏
- 隐藏UITabbarController
- 隐藏UITabBarController
- UITabBarController 隐藏
- UITabBarController 隐藏标签栏
- UITabBarController隐藏和显示
- 隐藏UINavigationController和UITabBarController
- UITabBarController自定义以及隐藏
- 隐藏UITabBarController的tabBar
- 变相隐藏UITabBarController的TabBar
- UITabBarController 隐藏 Bootom Tab Bar
- 关于UITabBarController的UITabBar隐藏问题
- UITabBarController的隐藏与显示?求大神
- 隐藏UITabBarController 并去掉隐藏后的白边
- UITabbarController
- UITabBarController
- UITabBarController
- UITabBarController
- linux 系统调用
- LinkedList的相关内容
- 解决ora-12514 问题
- 项目开发追求速度 还是 质量
- SQL Server优化50法
- 隐藏UITabbarController
- 高手详解SQL性能优化十条经验
- HashSet
- WinCE6.0下TCPMP的BenchMark汇总
- Python 常用包收集
- c++builder中使用TWebBrowser获取document对象的方法
- 2013年3月陕西综合性网站及社区网站 综合影响力排名
- 毕业论文——为谁辛苦为谁甜
- 项目管理实践一 工具