ios - 快速拉动刷新

标签 ios swift uirefreshcontrol

我有我的 refreshcontrollerscrollview..

  self.refreshControl = UIRefreshControl()
        self.refreshControl.attributedTitle = NSAttributedString(string: "Frissítéshez húzzad! :)")
        self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
        self.scrollView.addSubview(refreshControl)

func refresh(sender:AnyObject)
    {

//my refresh code here..

            self.refreshControl.endRefreshing()
    }

我将作为 subview 添加到 scrollView。它在页面内容溢出屏幕时起作用。但是当我没有收到太多数据并且它没有溢出时,问题就出现了,pull and refresh 功能不工作。 :(

我没有使用 tableview

谁能帮我解决这个问题?

最佳答案

self.scrollView.scrollEnabled = true
self.scrollView.alwaysBounceVertical = true

var alwaysBounceVertical: Bool // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically

关于ios - 快速拉动刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29791995/

相关文章:

ios - 更改facebook iOS登录和注销按钮的背景

ios - 除非正在编辑 subview 内的 textView,否则 TabViewController 中的 RightBarItem 不会触发

ios - RefreshControl 在其中一个选项卡中不起作用,其代码在其他选项卡中以类似方式使用

ios - UIRefreshControl 无法正常工作

ios - 在 Swift iOS 中接听电话

ios - TableView ContentInset 不缩小单元格宽度/向 TableView 内容添加水平填充

ios - 使用比率使绘图适合 iPad 和 iPhone

ios - 在 Instruments 中录音时应用程序崩溃

Swift - ButtonWithType 和 as 的问题

uitableview - 下拉以刷新 tableviewcontroller 负载