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

来源:互联网 发布:中央财经大学命案知乎 编辑:程序博客网 时间:2024/05/22 13:15

  隐藏tabbar

 */

- (void)hideTabBar {

    if (self.tabBarController.tabBar.hidden == YES) {

        return;

    }

    UIView *contentView;

    if ( [[self.tabBarController.view.subviewsobjectAtIndex:0]isKindOfClass:[UITabBarclass]] )

        contentView = [self.tabBarController.view.subviewsobjectAtIndex:1];

    else

        contentView = [self.tabBarController.view.subviewsobjectAtIndex: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.subviewsobjectAtIndex:0]isKindOfClass:[UITabBarclass]])

       

        contentView = [self.tabBarController.view.subviewsobjectAtIndex:1];

   

    else

       

        contentView = [self.tabBarController.view.subviewsobjectAtIndex: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;

   

}

0 0
原创粉丝点击