Alexandre Lara
Alexandre Lara

Reputation: 2568

Disable "pull to refresh" space on top of UICollectionView

I'd like to know if it's possible to disable the "pull to refresh" space on top of a collection view, when the user reaches the top of it.

This is the normal state:

enter image description here

And this is when I pull it down, there is this blank space that I'd like to avoid:

enter image description here

Upvotes: 1

Views: 2921

Answers (2)

zombie
zombie

Reputation: 5269

This is called bouncing.

and you can disable it either in editor

just select your CollectionView and under inspector you will find the bounces properties

disable them (or just what you want)

inspector

or programmatically

override func viewDidLoad() {
    super.viewDidLoad()
    collectionView.bounces = false
    collectionView.alwaysBounceVertical = false
}

Upvotes: 7

Luke
Luke

Reputation: 7220

Set collectionView.bounces and collectionView.alwaysBounceVertical to false.

Upvotes: 2

Related Questions