您的位置:首页 > 产品设计 > UI/UE

显示 隐藏 tabbar的方法(环信UI中使用的)

2016-01-11 18:34 453 查看
  隐藏tabbar
 */
- (void)hideTabBar {
    if (self.tabBarController.tabBar.hidden
== YES) {
        return;
    }
    UIView *contentView;
    if ( [[self.tabBarController.view.subviews
objectAtIndex:0]
isKindOfClass:[UITabBar
class]] )
        contentView = [self.tabBarController.view.subviews
objectAtIndex:1];
    else
        contentView = [self.tabBarController.view.subviews
objectAtIndex:0];
    contentView.frame =
CGRectMake(contentView.bounds.origin.x,  contentView.bounds.origin.y, 
contentView.bounds.size.width, contentView.bounds.size.height
+ self.tabBarController.tabBar.frame.size.height);
    self.tabBarController.tabBar.hidden
= YES;
   
}
/**
 *  显示tabbar
 */
- (void)showTabBar

{
    if (self.tabBarController.tabBar.hidden
== NO)
    {
        return;
    }
    UIView *contentView;
    if ([[self.tabBarController.view.subviews
objectAtIndex:0]
isKindOfClass:[UITabBar
class]])
       
        contentView = [self.tabBarController.view.subviews
objectAtIndex:1];
   
    else
       
        contentView = [self.tabBarController.view.subviews
objectAtIndex:0];
    contentView.frame =
CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, 
contentView.bounds.size.width, contentView.bounds.size.height
- self.tabBarController.tabBar.frame.size.height);
    self.tabBarController.tabBar.hidden
= NO;
   
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: