Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding the tabBar in a UITabBarController not changing bottom layout guide to the bottom of the screen

I am using autolayout in my project and I have a tableview in my view controller. So I have set its vertical spacing from the bottom of top layout guide and from the top of bottom layout guide to be 0. but when I hide the tab bar, the tableView does not extend to the bottom of the screen. Does this mean that iOS does not adjust the bottom layout guide when tab bar is hidden?

like image 539
Ashish Awaghad Avatar asked Nov 01 '22 07:11

Ashish Awaghad


1 Answers

The answer to your question is no, the bottom layout guide is not changed when you hide the bar.

Why? Simply because the tab bar is not removed from its superview, it's just hidden and thus the bottom layout guide shouldn't change. What would happen if you were to show it back again?

(lldb) po [[[self tabBarController] tabBar] isHidden]
0x0000000000000001

(lldb) po [[self tabBarController] tabBar]
<UITabBar: 0x14dd3f890; frame = (0 519; 320 49); hidden = YES; autoresize = W+TM; userInteractionEnabled = NO; layer = <CALayer: 0x17022c760>>

As you can see, the bar is still 'there', it hasn't been removed from the hierarchy and as a consequence, the bottom layout guide doesn't change. This is expected behaviour.

like image 56
Alejandro Benito-Santos Avatar answered Jan 04 '23 15:01

Alejandro Benito-Santos