Search code examples
tvos

Auto layout not ignoring UITabBar in tvOS


I have constrained one of my UIViews to the top of the main UIViewController view, and I would expect that the "top" of the main superview would not change if the tab bar is open. However, that is not the case. When the View Controller loads, the top of the view I constrained is the bottom of the Tab Bar. The view does not move with the UITabBar, rather stays a fixed distance from the top of the screen, leaving space for the tab bar to occupy. Is this the intended behavior, and if so, is there a workaround (to have the view extend under the tab bar)?


Solution

  • I believe this will solve your problem — seems to have worked for me.

    enter image description here

    On the storyboard, select your View Controller and go to the Attributes Inspector. Uncheck Under Top Bars. The view will now adjust once you select it in the tab bar.