Search code examples
swiftuiscrollviewuikituirefreshcontrol

ScrollView.refreshControl = refreshControl does not show custom settings. Function executes, but no display feedback


I have a ScrollView with 3 collection views within it. I implemented a refresh control. The refresh control correctly functions in the sense that it triggers the required function - and even pulls down the scroll view with a delay.

However, setting any of the refreshControls properties (such as text/background colour) have 0 effect when I add the refresh control to my scrollView like so:

scrollView.refreshControl = refreshControl

When I use the old method:

scrollView.insertSubview(refreshControl, at: 0)

I am able to see the text/spinner, but it's buggy.

Is there a reason that the refreshControl's properties might be hidden from view when not using insertSubview?


Solution

  • Thanks to a user named Matt over on this question: UIRefreshControl not showing in landscape when in a navigation controller with large titles

    I was able to identify that this indeed was caused by Large Title Preferred: Automatic set in Storyboards for my navigation titles. Even though my nav bar is hidden on the view controller, the undesired effect of it hiding my refreshControl still existed. To fix this, as Matt says:

    "If you turn off Prefers Large Titles everything is fine. I've played with some other settings, but no effect."