快速拉动刷新 [英] swift pull to refresh
本文介绍了快速拉动刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 refreshcontroller
带有 scrollview
..
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()
}
我将子视图
添加到 scrollView
。当页面内容溢出
屏幕时,它正在工作。但问题是,当我没有收到太多数据并且它不是溢出
时,拉动和刷新
功能不是加工。 :(
I'm adding as a subview
to a scrollView
. It's working when the page content is overflowing
the screen. but the issue arise when i haven't received much data and it's not overflowing
, the pull and refresh
function is not working. :(
我没有使用 tableview
。
有人可以帮我解决这个问题吗?
Can anybody help me how to solve this problem?
推荐答案
self.scrollView.scrollEnabled = true
self.scrollView.alwaysBounceVertical = true
var alwaysBounceVertical:Bool //默认NO。如果是,弹跳是YES,即使内容小于边界,也允许垂直拖动
var alwaysBounceVertical: Bool // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically
这篇关于快速拉动刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文