我正在通过 Parse.com 解析数据,但我在动态设置 View 和随时间刷新 View 时遇到了问题。 示例:当我设置 3 个 View 时,它工作正常。如果我需要设置更多的 2 个 View ,我不知道该怎么做。
有没有办法像拉动刷新(在 TableView 范围内)之类的那样刷新它?
希望您理解并感谢您。
最佳答案
这应该能帮到你。在您的 TableViewController 中添加此代码
var refresher: UIRefreshControl!
override func viewDidLoad() {
super.viewDidLoad()
refresher = UIRefreshControl()
refresher.attributedTitle = NSAttributedString(string: "Pull To Refresh")
refresher.addTarget(self, action: "refresh", forControlEvents: UIControlEvents.ValueChanged)
self.resultsTable.addSubview(refresher)
}
func refresh(){
//add code
}
关于swift - 刷新基于页面的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33138444/