Moisés Olmedo
Moisés Olmedo

Reputation: 929

UIRefreshControl weird jump when scrolling down with preferLargeTitles enabled

My UIRefreshControl is not working properly when I scroll down my collectionview. The refreshControl pops out even with a slight scrolling and causes the title to jump down a bit.

I tried with:

extendedLayoutIncludesOpaqueBars = true

And that fixes something but still does a small jump (almost unnoticeable) when scrolling down to engage the refresh control. If I do prefersLargeTitles = false, it works fine, no jumping.

Upvotes: 3

Views: 393

Answers (1)

Moisés Olmedo
Moisés Olmedo

Reputation: 929

I spent hours trying to fix it thanks to the poor Apple documentation on UIRefreshControl but finally found a solution. You have to add your refreshControl in the viewDidAppear method, I was adding it on the viewDidLoad method:

    override func viewDidAappear(_ animated: Bool) {
        super.viewDidAppear(animated)
        collectionView.refreshControl = refreshControl
    }

Upvotes: 1

Related Questions