IOS 7 hide tab

Hide panel in iOS7 shows informal behavior

When i use

self.tabBarController.tabBar.hidden = YES;

Above code hides tabBar, but mine from bottom to bottom does not remain interactive

But when I use it just before clicking viewController in the navigation

someViewController.hidesBottomBarWhenPushed = YES
[self.navigationController pushViewController:someViewController animated:YES];

It hides the tab, and the bottom view is also interactive. but the problem in this case is that when we pop the viewController, it shows a black bar just above the scoreboard for a few seconds.

+4
source share
5 answers

Hope you have a solution. Just to make sure you tried

 self.edgesForExtendedLayout = UIRectEdgeBottom;
+10
source

, - / autoresizingMask ( , ).

, UITabBarController , view, tabBar . , , , / .

Edit:

, SDK , category -.

UITabBarController "" ( ), subviews .

0

, / UITabBarController :

:

 - (void)hideTabBar:(UITabBarController *) tabbarcontroller
 {
     for(UIView *view in tabbarcontroller.view.subviews)
     {
        if([view isKindOfClass:[UITabBar class]])
       {
           [view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
        }
        else
        {
           [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
        }
     }
  }

:

   - (void)showTabBar:(UITabBarController *) tabbarcontroller
     {

         for(UIView *view in tabbarcontroller.view.subviews)
         {
            if([view isKindOfClass:[UITabBar class]])
            {
               [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
               [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 431)];
            }
         }
      }

, .

0

, , Objective-C, Swift 3.0, , . :

func hideTabBar() {
    let tabBarControllerView = self.tabBarController?.view
    if let tabBarControllerSubviews = tabBarControllerView?.subviews {
        for view in tabBarControllerSubviews {
            if view is UITabBar {
                view.frame = CGRect(
                    x: view.frame.origin.x,
                    y: (UIScreen.main.bounds.size.height == 568 ? 568 : 480) + 20,
                    width: self.view.frame.size.width,
                    height: self.view.frame.size.height
                )
            } else {
                view.frame = CGRect(
                    x: view.frame.origin.x,
                    y: view.frame.origin.y,
                    width: self.view.frame.size.width,
                    height: UIScreen.main.bounds.size.height == 568 ? 568 : 480
                )
            }
        }
    }
}

func showTabBar() {
    let tabBarControllerView = self.tabBarController?.view
    if let tabBarControllerSubviews = tabBarControllerView?.subviews {
        for view in tabBarControllerSubviews {
            if view is UITabBar {
                view.frame = CGRect(
                    x: view.frame.origin.x,
                    y: (UIScreen.main.bounds.size.height == 568 ? 519 : 431),
                    width: self.view.frame.size.width,
                    height: self.view.frame.size.height
                )
            } else {
                view.frame = CGRect(
                    x: view.frame.origin.x,
                    y: view.frame.origin.y,
                    width: self.view.frame.size.width,
                    height: UIScreen.main.bounds.size.height == 568 ? 519 : 431
                )
            }
        }
    }
}
0

.

:

-(void)hideTabBar:(UITabBarController *)tabbarcontroller
    {
        CGRect screenRect = [[UIScreen mainScreen] bounds];

        float fHeight = screenRect.size.height;
        if(  UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) )
        {
            fHeight = screenRect.size.width;
        }

        for(UIView *view in tabbarcontroller.view.subviews)
        {
            if([view isKindOfClass:[UITabBar class]])
            {
                [view setFrame:CGRectMake(view.frame.origin.x, fHeight, view.frame.size.width, view.frame.size.height)];
            }
            else
            {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, fHeight)];
                view.backgroundColor = [UIColor blackColor];
            }
        }
    }

:

-(void)showTabBar:(UITabBarController *) tabbarcontroller
{
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    float fHeight = screenRect.size.height - 49.0;

    if(  UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) )
    {
        fHeight = screenRect.size.width - 49.0;
    }
    for(UIView *view in tabbarcontroller.view.subviews)
    {
        if([view isKindOfClass:[UITabBar class]])
        {
            [view setFrame:CGRectMake(view.frame.origin.x, fHeight, view.frame.size.width, view.frame.size.height)];
        }
        else
        {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, fHeight)];
        }
    }
}

Use these methods in the WillAppear view and device rotation methods as per your requirement.

-1
source

Source: https://habr.com/ru/post/1524490/


All Articles