In iOS 7, why does the UITableView contentInset have a lower value despite hiding the UITabBarController?

I don't know why the UITableView has a bottom insert automatically, even though I hide the UITabBarController by calling [setHidden:YES] before.

A view controller that has a UITableView has a child UITabBarController . I already know that automaticallyAdjustsScrollViewInsets helps any UIScrollView get the proper 'contentInset' depending on the status of this container view controller.

So, I was expecting the bottom content of the UITableView to be 0 if the UITabBar is hidden. But it doesn’t.

Although AdjustsScrollViewInsets is automatically YES, should I manually adjust this value when the UITabBar is hidden?

+1
source share
2 answers

Tablet braces were never intended to be hidden - because why do you need a UITabBarController if you want to hide the tab bar. In the documentation, you cannot directly modify the tab bar object:

You should never try to manipulate the UITabBar object itself stored in this property.

This is exactly what you do when you set it to hidden.

In iOS6, this worked, but now in iOS7 it is not. And she seems very inclined to hide it. When you finally manage to hide it, if the application goes to the background and returns, the Apple layout logic overrides your changes. There are many such triggers.

My suggestion is to change your design. Perhaps the data will be displayed modally.

0
source

Put this here for those who get this problem for nested view controllers.

My view controller containment hierarchy:

 UINavigationController |--UIViewController |--UITabBarController |--UIViewController 

The last view controller has a UITableView , whose scrollIndicatorInsets continues to get offset using the UITabBar height tablet bar controller , even if it's hidden .

Decision. Set automaticallyAdjustsScrollViewInsets to false in the view controller, which contains the tab bar controller (and is located inside the UINavigationController ). No need to set additional properties in the controller of the tab bar and the second controller of the view, where the UITableView is located.

0
source

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


All Articles