【问题标题】:swift 3 - UIRefreshControl not working in large screenswift 3 - UIRefreshControl 在大屏幕上不起作用
【发布时间】:2016-11-09 02:49:58
【问题描述】:

我有一个UICollectionView,我想在其中集成一个UIRefreshControl,以使用户能够向下滑动以刷新。

假设我的UICollectionView 中有 5 个项目。如果我在 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()

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

你有什么想法吗?

提前致谢

【问题讨论】:

    标签: ios swift3 screen uirefreshcontrol


    【解决方案1】:

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

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

    如果您想让UICollectionView 始终可滚动。

    alwaysBounceVertical 属性设置为true。 (由UIScrollView继承)

    【讨论】:

      猜你喜欢
      • 2018-02-03
      • 1970-01-01
      • 2022-07-22
      • 2017-07-22
      • 2018-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多