Use tvOS 13 UITabBarController compiled with Xcode 11 - tabBarObservedScrollView to scroll with content - tvos13

My current project has a UITabBarController and in the UIViewController I have a ScrollView and inside that I have a Stack View.
The new default behaviour for the UITabBarController is to be pinned to the screen and allow the content to scroll underneath it.
But you are able to set an instance property to allow the tab bar to scroll away with the content as you navigate down.
I'm trying to set the instance property tabBarObservedScrollView in the viewWillAppear of the viewController as mentioned in the WWDC video at min 38 here: https://developer.apple.com/videos/play/wwdc2019/211/
But the problem I'm getting is that it doesn't scroll away. I've put a sample application together in GitHub so I can share it here to see if I'm doing something wrong.
If anyone has come across this issue already I'd be pleased to know how to fix it. Thanks :-)
https://github.com/kyazdani/TVTabBarScrollAway

You need to set tabBarObservedScrollView on the actual view controller that is part of the array of view controllers that the UITabBarController handles.
In your example code you set it on the scroll view, but it's your UINavigationController that the UITabBarController manages, you need to set it there.

Related

Using An Image View In Xamarin iOS

I am trying to setup an image view in my Main.Storyboard so that I can update it in my app extension. I am struggling to work out how to get the code to initialise the Image View. I feel so stupid for not being able to figure this out.
In Xcode, I am used to linking it by dragging the constructor (if that's what it's called) into the app code.
How is this accomplished in Xamarin?
Much thanks.
In the storyboard, select the UIImageView. Then in the properties window (on the right, usually) there is a Name property. That creates an outlet to your view controller class with UIImageView. You can access it in the ViewDidLoad method (that's the earliest it's guaranteed to be initialized) and setup the UIImageView however you need.
See this screenshot showing the Name property:

Xcode UICollectionViewCell xib not displaying any views added to it

I'm trying to create a custom UICollectionViewCell backed by a *.xib file.
However, when I try to add subviews to the cell, interface builder (as well as an actual instance of the cell inside the app) doesn't show them at all.
It doesn't matter whether I add in an UIView as a contentView or not, all subviews seem to be invisible.
This happens in Xcode 7.2 inside a tvOS project. Does anyone experience the same issue or can see what I'm missing?

In Xcode, how do I create an outlet for a button that is inside a container?

I'm a total newbie with xcode and swift, trying to wrap my head around ios programming.
I'm designing a storyboard for my app. The storyboard uses containers to keep track of the controls. In one of the containers resides a button. I want to create an outlet for it to add some code when it is clicked.
If the button would be on the base viewport of the storyboard, I would control-drag a blue line from the button to the source window with my UIViewController subclass file, and it would assist me in generating the code. But for some reason when the button is in a container, this just doesn't work.
When following the documentation, it says to open the assistant editor when the button is selected and it should open the relevant file. So it open an objective-c file, but when I try to control-drag into it, it informs me that I do not have write permissions. Also I feel like I should be doing it in a subclass instead.
I have searched online a lot and tried everything I can think about, but nothing has worked so far. How does this work? Can I do it programmatically or so perhaps? I hope someone can straighten out this question mark...
A container view is intended to represent an area that will host a view from a different view controller that becomes a child of the view controller that owns the container. Usually, you would create a second view controller, link your container view to it using an "embed" segue, and then put your buttons and such in the second controller's view. The code behind those would then go into the second controller.
If your purpose is simply to have superviews to control layout within a single view controller, use a UIView rather than a container and the problem goes away. That's what the Editor->Embed In->View menu item is for.

Showing views in interface builder outside viewcontroller hierarchy in xcode5

I often make use of views in interface builder that live outside of the viewcontroller hierarchy (see screen grab below for simple example).
Before upgrading to Xcode5 I could get this view to appear on the storyboard by writing an IBAction outlet and dragging a connection from the code to the view in the storyboard.
If you paused over the button for a moment it would flash and then open up as a view on the storyboard that is then a lot easier to work with.
Since upgrading this function no longer seems available. Has anyone found out how to get these views to appear on the storyboard?
Edit:
Using the temporary viewcontroller as described in this answer seems one approach, although fiddly since you need to move the UIView stack between viewcontrollers each time you want to edit the layout. Using a separate XIB is starting to seem like the sanest approach.
https://stackoverflow.com/a/13713385/1060154
Finally, we get this back in Xcode 7.
Hallelu!

XCode, Storyboard, View Controller items are not being displayed

When opening up a project today, there is some weird behavior in XCode. Things have disappeared in the storyboard view like the NavigationBar in viewController, the buttons associated with it, etc. I can see in the Scene list that they still exist. Is there any way to have these show up again?
You probably need to add a navigation controller to your storyboard and make your view controller the root. You cannot simply set the top bar in simulated metrics in storyboard to navigation bar.

Resources