Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum number of view controllers in UITabBarController for tvOS

Tags:

What is the maximum number of view controllers in UITabBarController for tvOS? It's not documented on developer.apple.com.

The screen is obviously bigger than iOS devices. I know for iOS it will add a "More" button if the number is bigger than 5.

The More Navigation Controller The tab bar has limited space for displaying your custom items. If you add six or more custom view controllers to a tab bar controller, the tab bar controller displays only the first four items plus the standard More item on the tab bar. Tapping the More item brings up a standard interface for selecting the remaining items. The interface for the standard More item includes an Edit button that allows the user to reconfigure the tab bar. By default, the user is allowed to rearrange all items on the tab bar. If you do not want the user to modify some items, though, you can remove the appropriate view controllers from the array in the customizableViewControllers property.

Note

Tab bar customization and the More interface is not available in tvOS

Differences in tvOS

Tab bar controllers serve the same purpose in tvOS as in iOS, but provide slightly different user interface features: The tab bar interface appears at the top of the window. When focus leaves the tab bar, the tab bar is hidden. Swiping up on the remote shows the tab bar again and focuses it. A user can also show and focus the tab bar by pressing the Menu button. Swiping down from the tab bar moves focus into the content view; specifically, to the first focusable view that is visually below the selected tab. Swiping down behaves like a normal focus-changing gesture—that is, focus moves in the direction the user swiped. If nothing is focusable immediately below the selected tab, the closest focusable view is focused instead. Pressing the Select button while a tab is focused moves focus into the content view. Because there is no direction associated with this change, focus moves to the view specified in the content view's preferredFocusedView property. Tab bar controllers in tvOS do not support customization. A tab bar controller displays only the number of view controllers from its viewControllers array that fit on the screen, and does not provide the More interface seen in iOS.

like image 392
mgyky Avatar asked Nov 08 '17 18:11

mgyky


1 Answers

I found it by adding ViewControllers in StoryBoard. No matter how smaller your buttons are, the answer is 7. It will hide if it's more than 7 ViewController. And no "More" button of course. I added an 8 view controller but it only shows 7 (seven).

The answer is 7

Great, right?!

Solution

Sadly, I wrote my own TabBarController :( Which is not a subclass of UITabBarController but UIViewController. Hoping Apple will change this (they'll not.). Should be depending on the size of the buttons, and could auto calculate each specific case.

Best.

like image 182
mgyky Avatar answered Oct 13 '22 01:10

mgyky