swift 3 - UIRefreshControl无法在大屏幕上工作

qua*_*yen 1 screen ios uirefreshcontrol swift3

我有一个UICollectionView我想要集成的内容UIRefreshControl,以便用户可以向下滑动以刷新.

说我的5件物品UICollectionView.如果我在iPhone5中运行我的应用程序,那么UIRefreshControl工作得很漂亮.但是,如果我在iPhone6Plus中运行它(所有5个项目都适合屏幕),那就UIRefreshControl不再适用了; 我甚至无法将其滑落.

是否有任何属性UIRefreshControl可以帮助用户在任何情况下向下滑动,无论屏幕大小是多少?我看了UIRefreshControl下面的课,但看起来这些都无济于事:

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()
Run Code Online (Sandbox Code Playgroud)

一个丑陋的解决方案是制作一个我不想要的刷新按钮.

你有什么想法吗?

提前致谢

Joh*_*nny 6

那是因为你的collectionView contentSize不够大,无法滚动.(它比屏幕尺寸小).

UIRefreshControl仅在您的scrollView可滚动时才有效.

如果你想让你的UICollectionView总是可滚动的.

alwaysBounceVertical属性设置为true.(继承者UIScrollView)