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

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.

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.

Related

How to change "MENU" button behaviour to not terminate App

Just right at the start: I don't want to change the user experience from Apple's user experience guidelines, I actually want to bring it back to my App, so here's the problem:
The "MENU" button should go back one level in the navigation hierarchy and terminate the App if there is no level anymore.
My first navigation screen also has an initially hidden full screen view (e.g. a video player). From this first navigation screen the user can go to deeper levels. The "MENU" button has its correct standard behavior.
The deepest navigation level then shows the hidden full screen view. When the user presses "MENU", the navigation should go back to the last level, but instead it terminates the App.
How can I change the behavior of the "MENU" button just for this single view?
It is not difficult to implement this. Just make sure the initial Screen that is displayed to the User is not the root View.
I will put the stack here.
Root View contains two views namely,
VideoContainerView and
MainContainerView.
VideoContainerView will have a UIViewController, which has menuHandler button listener. This VC displays anotherView on top of RootView on button press.
MainContainerView will have UIViewController, which doesn't have any menuHandler. MainContainerView is displayed on top of the VideoContainerView.
STACK
MainContainerView (Top)
VideoContainerView
RootViewController
RootView -> VideoContainerView (A View containing VideoScreenController)
RootView -> MainContainerView (A View containing MainViewController)
RootView -> VideoContainerView -> VideoScreen (Initial Screen, make sure this is a View Controller displayed on top of that FirstView using ContainerView).
From the VideoScreenController, Menu button press will display the RootView's MainContainerView which was hidden till now on top of that VideoContainerView.
On Next Menu button press, the app will go to background, as the MainViewController doesn't handle any menu Button press.
Never listen to any MenuButton press on the RootView's topView.
One can easily control the preferred focus flow using,
override var preferredFocusEnvironments: [UIFocusEnvironment] {
if topView.isHidden {
return [VideoContainerView]
} else {
return [MainContainerView]
}
}
Like wise, have preferredFocusEnvironments in every ViewController to handle the initial preferred Focus, so that system is aware which is currently focused.
The above code, helps the system to know, which view should be focused on launch or on every focus change.
The thing that actually causes your app to exit is if the pressesEnded:withEvent: for the Menu button press makes it all the way up the responder chain to UIApplication. So if you prevent that from happening, the app won’t exit.
There are two ways to do that: either somebody in the responder chain needs to override that method and not call super, or somebody in the responder chain needs to have a gesture recognizer that recognizes that button press.
UINavigationController, for instance, uses the latter. It also disables the gesture if the navigation stack is at its root; that way, attempting to pop the last view controller actually exits the app.

How to focus Buttons (or other widgets) with TalkBack turned ON in Android Device?

I'm implementing Accessibility in my application. Here's the scenario :
I have 4 buttons arranged horizontally at the very top of the screen (Activity). On the click of a button, I'm launching an Alert Dialog which displays something to the user. With the alert being displayed, I will still be able to perform click operations on those 4 buttons at the top of the screen. When I turn ON TalkBack (Android Accessibility Service) in Android device and click on that button, alert is getting displayed but I'm unable to move the focus (a yellow rectangular box which will be there when TalkBack feature is turned ON in Android phone) to those 4 buttons. Please help!
Try to set the below properties to your buttons
android:importantForAccessibility="yes"
android:focusable="true"
You won't be able to do it with a dialog, you'll need to fake it with a View.
Perhaps you are using the wrong component which is why it sounds odd when you describe it? A picture of your design would help provide some context.
As #aardrian says, the alert dialog is modal and will (and does) block user input from the underlying UI. Clicking away from the dialog or pressing back will dismiss the dialog.
With TalkBack enabled, the user will be able to press the system back button, use the back gesture (swipe down, then left) or select an option within the dialog to dismiss it.
Try to integrate voice control into your application via Accessibility TalkBack
Define 4 buttons, Alert Dialog Box as objects, selected by voice:
button 1
button 2
...
...
I am studying the limitations of voice control of Android smartphone/ device in Blind Mode ( eyes-free)

page controller with tab control

I'm using a tabbed application. I want to have a page control in one of my tab views. When I place the page control and link it to another view controller, I can change pages like I want too, but the tab bar disappears completely from the bottom. How can I keep my tab bar to stay even in a different page control view?
Assuming you're doing this in storyboard:
Option-drag from the tab view controller to the target view controller.
A pop up will appear - make sure you pick the 'View Controllers' option under 'Relationship Segue' rather than anything under 'Manual Segue'.

AppBar remain constant for entire Page Control in Metro Apps?

Am trying to display AppBar for entire html page in my Metro app.Whenever I click on the other items of the page, immediately AppBar is disappearing.Can anyone give me advice to set my AppBar remain constant for entire page in Metro App.Here am using appbar.winControl.show();.
For JavaScript: appBar.sticky = true;
For XAML: AppBar.IsSticky = true;
This will keep your AppBar on the screen even if you click elsewhere on the page. But remember that the design guidance is for a transient AppBar that will light-dismiss (disappear when you touch somewhere else). Here is the guidance for when it should be sticky, from the guidelines and checklist for app bars:
Do set the app bar's dismissal mode to sticky when displaying contextual commands.
If you have contextual commands on an app bar, set the mode to sticky while that context exists and turn off the sticky mode when the context is no longer present (such as when a photo is deselected). In sticky mode, the bar doesn't automatically hide when the user interacts with the app. This is useful for multi-select scenarios or when the context involves interaction such as manipulating cropping handles. The bar stays visible while the user performs the actions. The user can still hide the bar by swiping the top or bottom edge of the screen and they can show it again with an edge swipe.
Finally, here is the JS reference for the sticky property.

Have a click anywhere on a web page open a select dropdown

I'm building a web page that will be viewed on mobile devices (Blackberry specifically). I have navigation drop down of sorts implemented as a <select> in the upper left corner of the page. Rather than require the user to click on the drop down directly I'd like to have so that the user can click/tap anywhere on the page the select drop down in the upper left corner opens. The page has no other links or clickable objects other than the select drop down in the upper left.
Is this even possible? From what I've found so far it seems that it's impossible to programmatically open a <select> drop down, but I figured I'd throw this specific case out there.
Since it's not possible to fake key presses with JavaScript (and rightfully so for security reasons), the closest thing is to change the size of the <select> element (change it from a drop down control to a list box control and back).
Demo, Code (pure JS, no library)
When the user selects an option by clicking (or tapping) it, the click event handler 'closes' the list box by setting its size back to 1, after which it converts back to a normal drop down control. I have only tested this in (non-mobile) Chrome, let me know if it works on Blackberry or not.
Edit:
I have created a small jQuery plugin that wraps behavior and configurability into a more comprehensible control. I have tested this on Safari Mobile on iOS 4 and it behaves just like a regular drop down does in that browser, except it can be opened programmatically.
Demo, Code (jQuery 1.7)
It works like this:
$("select").openable({ triggers: $("#trigger") });
Clicking on any trigger will open the selection UI.
I have also added a handler for the key up event to catch Enter, Esc and Space to 'close' the list box. This mimics the drop down control's selection mechanism on desktop browsers.
Of course, on a desktop browser this will change the layout of your page, as it's different from the native drop down control. You will have to come up with a CSS solution for that (something with position: absolute and z-index probably). But on iOS the selection UI isn't rendered on the page, so it's not a problem.
Again, haven't tested this plugin on BlackBerry...