Cant' dismiss a UISearchContainerViewController on tvos - swift

So I'm working on a full screen tvos video application. No Tab bar, No Navigation Bar.
I've been trying to add Search functionality to this app.
I'm using a gesture during development to display the search feature.
I instantiate the results controller from my storyboard, then programmatically add that results ViewController to a UISearchController and then wrap that in a UISearchContainerViewController.
I then add that UISearchContainerViewController to my parent ViewController via: addChildViewController, set frame, view.addSubview, didMoveToParentViewController....
(per https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html)
This successfully displays a functional search controller full screen over my now paused video.
BUT, when I try to dismiss the search ViewController it won't go away...........
I attempt to dismiss the UISearchContainerViewController via: willMoveToParentViewController(nil), view.removeFromSuperView() and removeFromParentViewController... The view does not disappear...
I've verified that the gestures are being called... and I've gone so far as to verify that the parents childViewController no longer contains the UISearchContainerViewController... but the Search interface remains??
I've simply hiding the UISearchContainerViewController for grins... it does not go away!?
I'm going to try a modal presentation as a fallback, but it's not the desired solution... and now I'm personally bugged as to why this doesn't work.
Any help will be greatly appreciated.

Related

Present small ViewController on tabbarcontroller

Im having a tabbarcontroller with more than 5 tabs on it. I tried MS Teams like UI. But unable to present it as a small VC presenting on top of tabbarcontroller. I tried presenting views on tabbar item click but
Unable to fire the tabbar select event on first tap on the button
Unable to present over the currently selected view controller
Unable to present on top of tabbar controller(view hiding the tabbar)
#Microsoft Teams app
Please help me out to implement the same behaviour or comment if u know any library to perform this.
You should check Aiolos project on GitHub. It will allow you to show/interact with panels and you also be able to configure offset in Panel.Configuratio.magrins. Another way is to use custom transitions

Buttons of one particular view controller are not working

On tapping one button of first view controller, I am navigating to second view controller with performSegueWithIdentifier(identifier is given in storyboard and working fine).Second view controller will be shown in Landscape mode.
In second view controller there is a mapView(google). below the map, there is one button; on top of the map there is one more button, but both the button actions are not working.
userInteractionEnabled, enabled , accessibility all are correct.
Action methods are also dragged from storyboards properly and have been properly connected.(Removed and even connected again also)
Still action methods are not getting called. Buttons are also not clickable there.
Couldn't find the reason. thanks for help.

Load a view controller created inside a storyboard as a subview (into a part of the screen) of another view controller

I am currently developing as app for iPad. And I need to create a tabbar. The problem is that, for design purposes, I need the tabbar to be on the top half of the screen and not on the bottom as it is on the default tabbar controller.
Once the tabbar is on top I want that when a button is touched, the subview bellow the tab is changed. Furthermore, the subview that should be loaded was alson designed inside the storyboard. The following sketch shows what I want it to look like:
On my research I found a solution (here) for putting the tabbar on top. Now my problem is on loading a subview bellow it.
I tried it with [self.view addsubview:theNameOfTheViewCreatedINStoryboad.view] but the application simply hangs when I press the button.
I think that is because I am not specifying anywhere what should be the dimension of the new view or where on the scree should it be placed. The reason for that is because I do not know where it should be done.
Can anyone give me some lights on this matter? Is the referred approach the best one for putting a tabbar on top? How can I solve the subview problem?
Glad to see you are using a toolBar and not a tabBar. Even better would be to create a custom content view controller.
You should be looking into using containment:
UIViewController containment
How does View Controller Containment work in iOS 5?
positioning UIViewController containment children
check out the docs

Current UIView Questions iPhone SDK

I posted earlier but am running into similar problems again. Basically the way that my app is setup there is a top bar that is basically just a static image that has UIButtons placed on top of it. That is the Main View Controller and is persistent no matter what view is shown beneath it. I can't use a navigation controller because it is not possible to change the height and I need the bar to be significantly larger than a navbar. However my bar is functioning in much the same way. There is a "Home" Button, a "Back" Button and several destination buttons.
I understand how to switch views from say the home screen. My confusion comes with the back button. In order to press back the app is going to need to know what view is currently being displayed so that it can be removed from view and a new subview can be added. Ideally I would use the UINavigationController so that I can push and pop views which is really what I want to do here, however that is not possible because of the visual problem.
Does anybody know of a method that returns the current displayed view so I could do something like the following
[currentview.view removeFromSuperView];
[self.view insertSubview:experienceViewController.view atIndex:0]
You can use UINavigationController with the nav bar hidden. Put the nav controller inside a view that does have your jumbo toolbar and you'll have access to the push/pop behavior you're looking for.

How to force a screen orientation in specific view controllers?

My application is pretty simple: it starts up with a view controller that holds a table view (in grouped view layout) with a few options. When the user taps on one of the options, I push another view controller onto my navigation controller.
This second view controller simply displays a UIImageView, and the user can change the screen orientation on this view controller between portrait/landscape modes. This works just fine, and all is happy.
However, if the user taps on the "Back" button on my navigation bar while on the landscape mode, the first controller's layout is all messed up. See below for before/after screenshots:
(source: pessoal.org)
(source: pessoal.org)
Any clues on how to force the first view controller (second screenshot in this post) to stay within the portrait screen orientation?
There does not appear to be a way to do this using the documented methods.
I have filed a bug for this: rdar://6399924
"There is no way to always restrict a UIViewController to one orientation"
You can see it on open radar (along with a link to sample code to reproduce the problem) here: http://openradar.appspot.com/radar?id=697
Like someone on the open radar suggested, a workaround is to disable "back" button while in non-portrait:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
// don't let user press "back" button in landscape - otherwise previous view and the rest of the application
// will also be in landscape which we did not feel like testing yet
self.navigationController.navigationBarHidden = (UIInterfaceOrientationPortrait != self.interfaceOrientation);
}
There is a solution to do that : it's to use a view controller and adding its view to the window. then in that controller you force landscape in the shouldAutorotate... methode. It works fine, but be sure it's necessary for your project to use that, because it's not very smart  to force the user to turn his iPhone. By the way, here is an example code if you need it.
http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html
I wasn't able to get this to work the way I wanted. You ought to be able to set a particular orientation for a ViewController, but the NavigationController doesn't seem to always do the right thing.
I ennded up re-designing my screens so that they all work in either orientation. That might be extra work, but it "feels" more natural, anyway.