quanguyen quanguyen - 1 year ago 152
iOS Question

swift 3 - UIRefreshControl not working in large screen

I have a

in which I want to integrate a
in order to enable user to swipe down to refresh.

Say I have 5 items in my
. If I run my app in an iPhone5, then
works beautifully. However, if I run it in an iPhone6Plus (where all 5 items are fit in screen), the
just does not work any more; I even cannot swipe it down.

Is there any properties in
that can help user to swipe down in any situations, no matter what size the screen is? I took a look at
class below but it seems these cannot help:

public init()

open var isRefreshing: Bool { get }

open var tintColor: UIColor!

open var attributedTitle: NSAttributedString?

// May be used to indicate to the refreshControl that an external event has initiated the refresh action
@available(iOS 6.0, *)
open func beginRefreshing()

// Must be explicitly called when the refreshing has completed
@available(iOS 6.0, *)
open func endRefreshing()

An ugly solution is to make a refresh button, which I don't want.

You have any ideas?

Thanks in advance

Answer Source

That's because your collectionView's contentSize isn't large enough to scroll. (It's smaller than your screen size).

UIRefreshControl only works when your scrollView is scrollable.

If you would like to make your UICollectionView always scrollable.

Set the alwaysBounceVertical property to true. (Which is inherited by UIScrollView)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download