Hide UITabBar on iPad

This question has been asked a lot, and there are quite a lot of answers to them, but not one of the answers that I can find answers:

I have a UITabBarController

I want to hide the tab bar, so I call:

self.tabBarController.tabBar.hidden = YES 

This removes the panel, but now there is an empty black box that uses the tab bar. I tried to resize the ViewController frame, which is now displayed, and it is always located behind the black box to the left of the tab bar.

I also go through all the child objects and hide them, no luck.

Finally, I tried resizing the frame on the tab, and that doesn't do the trick either

Is anyone lucky with this?

also: hidesBottomBarWhenPushed does not work, because the application is not based on the UINavigationViewController, it is based on the UITabBarController.

This app is for iPad.

+6
source share
2 answers

I had the same problem. This is how I hid the tab bar:

 [self.tabBar removeFromSuperview]; UIView *contentView; if ([[self.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]]) { contentView = [self.view.subviews objectAtIndex:1]; } else { contentView = [self.view.subviews objectAtIndex:0]; } contentView.frame = self.view.bounds; 

This is called from tabBarController (I have subclasses of it), but it removes the tabBar and resizes the view to get rid of this black bar that you see now. Unless you have a subclass of tabBarController, I'm sure you can just change all instances of self to self.tabBarController , and it should work the same.

I hope this helps

+8
source

This is not an entirely elegant solution, but can you resize the UITabBarController to go past the bottom of the screen?

0
source

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


All Articles