How to stop TabBar hidden in change focus in tvos - uitabbarcontroller

I am working on apple tv app in swift. I need to implement TabBarController. In apple tv application TabBar hidden in change focus but I want to need show TabBar if user change focus in app.
How to do?

Use this method in UITabBarController Class
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator){
self.tabBar.hidden = false
}

Related

how to make swiftUI buttons exclusive?

using swiftUI i have a lot of Buttons which i need to make only one can be clicked at the same time.
By default in swiftUI you have two or more buttons on a view you can click them all at once
I tried adding the following:
UIButton.appearance().isMultipleTouchEnabled = false
UIButton.appearance().isExclusiveTouch = true
With UIKit we had exclusiveTouch and MultiTouchEnabled but how do we do this with swiftUI?
What is the correct way to solve this application wide?
Update: The use case is simple there is a view with a login button and a register button and now the user can tap both at the same time which i don't want

SwiftUI - am I an iOS widget or watchOS app?

I have a SwiftUI view which was originally only used for an iOS widget. I would like to re-use this view now for a watchOS app.
#Environment(.widgetFamily) var widgetFamily
The widgetFamily surprisingly was set to ".accessoryCircular". Is this some kind of strange default? This happens within the context of the main watchOS app - no widgets and no complications involved at this stage.
I would like to distinguish between the "accessoryCircular" iOS widget and the main watchOS app. How can I achieve this?

Navigation bar and Tab bar disappears when doing push segue

I have the following structure in InterfaceBuilder in XCode:
Tab bar controller
Navigation bar controller
View Controller A
.. push segue to..
View Controller B
However I cannot get the push segue to keep the nav bar and tab bar. It also animates from the bottom like a modal segue.
This is how I start the segue:
self.performSegueWithIdentifier(DETAIL_MEETING_SEGUE_ID, sender: self)
Both VC1 and VC2 have unchecked "Hide Bottom Bar on Push".
In Interface Builder tab bar and nav bar are showing correctly. Also, when dragging a segue directly from a button to VC 2 with push set it works perfectly.
Any ideas?
I experienced a similar issue after embedding tab bar stacks of VCs into navigation controllers. There was a storyboard push segue from VC a to VC b (in a different stack) that was called using performSegue:.
My fix:
Delete the segue in storyboard, then create it again the exact same way. After this the VC b showed the tab bar and the navigation bar as expected.
Filed a bug with Apple Bug Reporter.
I "solved" it by dragging a manual segue from the tableview cell to "View Controller 2". I then gave it the same name as before and made setup in prepareForSegue: as normal. I had to drag multiple segues but it was ok to use the same id for them.
If anyone have a better solution please write it here.

Using Storyboards Get TabBar Reference for UIActionSheet showFromTabBar

I have a storyboard with an initial splash view controller followed by a tabbar controller, navigation controllers, and tableview controllers. I need to present an action sheet from one of my tableview controllers.
[UIActionSheet showInView:self.view] does not work, because touches that fall in the tab bar area are not detected, so I must use [UIActionSheet showInTabBar:tabBar].
My question is how can I get a reference to the tab bar or the UITabBarController. Xcode does not allow me to connect a referencing outlet from the UITabBarController or from the UITabBar to any of my custom view controllers (presumably because view controllers on a storyboard are not static objects, but are only created when necessary and related by segues (?), so you aren't supposed to do it that way), but this leaves me with no way to get at the tab bar directly.
What is the right way to do this ?
There is probably a better answer to this question over here:
Storyboard - UITabBarController
In short, pull the root view controller off your appdelegate's window.
I just did the following in my viewWillAppear to hide my tab bar for that particular view:
AppDelegate *ap = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UITabBarController *tc = (UITabBarController *)[[ad window] rootViewController];
[[tc tabBar] setHidden:YES];

How to open a "window" in a modal?

I am creating an iOS app with the help of Rubymotion.
I am using a navigationController as a rootview and I need to open a window in a modal.
How can I do that?
You'll need to open it on top of another UIViewController. So, push a UIViewController onto your UINavigationController and then use the presentModalViewController:animated: method:
navigation_controller.pushViewController(main_view_controller, animated: true)
main_view_controller.presentModalViewController(modal_controller, animated:true)
When you're done with it, dismiss it:
main_view_controller.dismissModalViewControllerAnimated(true)