Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 752
Kaz Avatar asked Feb 04 '23 17:02

Kaz


1 Answers

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.

like image 80
ihux Avatar answered Mar 01 '23 23:03

ihux