获得“拉动刷新"的最佳方式是什么?来自 UITableView? [英] What's the Best Way to Get a "Pull to Refresh" from a UITableView?

查看:23
本文介绍了获得“拉动刷新"的最佳方式是什么?来自 UITableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITableView,它显示数据从连接了 WiFi 的设备接收.

I have a UITableView, and it displays data received from a WiFi-connected device.

我想做一个相当标准的手势响应,将表格拖下来,然后释放它,以触发更新.

I want to do the fairly bog-standard gesture response of dragging a table down, then releasing it, to trigger an update.

我想我可以将滑动手势识别器附加到桌子的基板视图上,但我想知道是否有办法直接从桌子本身拦截这个手势.

I guess I could attach a swipe gesture recognizer to the table's substrate view, but I'm wondering if there is a way to intercept this gesture directly from the table itself.

元:

我一直在浏览各种文档等等.我没有以前做这个,所以我从来没有想过.现在我看到我可能应该考虑一下.

I've been looking through the various docs and whatnot. I haven't had to do this before, so I never gave it any thought. Now I see that I probably should have thought about it.

如果这是一个明显的解决方案,我不介意被告知,只要你帮我找到明显"的补救措施.如果我会删除这个问题这是一个糟糕的.

If this is an obvious solution, I don't mind being told so, as long as you help me to find the "obvious" remedy. I'll delete this question if it's a bad one.

但是,我还没有找到解决方案,而且我通常很擅长那种东西.

However, I haven't found a solution, and I'm usually fairly good at that kind of thing.

更新我更改了标题以更好地反映我的要求.

UPDATE I changed the title to better reflect what I'm asking.

推荐答案

如果你添加一个 UIScrollViewDelegate 到你的 UITableView,你可以响应 scrollViewDidScroll: 事件.负的 contentOffset.y 值表示您的用户已在您的 tableview 顶部下拉.

If you add a UIScrollViewDelegate to your UITableView, you can respond to scrollViewDidScroll: events. A negative contentOffset.y value indicates that your user has pulled down at the top of your tableview.

这篇关于获得“拉动刷新"的最佳方式是什么?来自 UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆