首页 > iOS怎样通过这样的JSON数据,实现上下拉刷新加载更多

iOS怎样通过这样的JSON数据,实现上下拉刷新加载更多

{
"count": 87,
"next": "http://127.0.0.1:5000/api/v1.0/posts/?page=2",
"posts": [
{
"author": "http://127.0.0.1:5000/api/v1.0/users/2",
"body": "\u66f4\u597d\u6591\u6591\u9a73\u9a73\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d\u4e0d",
"body_html": null,
"body_title": null,
"comment_count": 0,
"comments": "http://127.0.0.1:5000/api/v1.0/posts/1/comments/",
"id": 1,
"timestamp": "Wed, 24 Jun 2015 06:40:03 GMT",
"url": "http://127.0.0.1:5000/api/v1.0/posts/1"
},
{
"author": "http://127.0.0.1:5000/api/v1.0/users/2",
"body": "\u770b\u770b\u770b\u770b\u5361\u5361\u5361\u5361\u9760\u9760\u9760\u9760\u9760\u9760\u9760",
"body_html": null,
"body_title": null,
"comment_count": 0,
"comments": "http://127.0.0.1:5000/api/v1.0/posts/2/comments/",
"id": 2,
"timestamp": "Wed, 24 Jun 2015 06:40:31 GMT",
"url": "http://127.0.0.1:5000/api/v1.0/posts/2"
},
{
"author": "http://127.0.0.1:5000/api/v1.0/users/2",
"body": "uuuuuuuuuuuuuuuuuuu\u6de1\u6de1\u7684\u6de1\u6de1\u7684\u6de1\u6de1\u7684\u6de1\u6de1\u7684\u6de1\u6de1\u7684\u6de1\u6de1\u7684\u6de1\u6de1\u7684",
"body_html": null,
"body_title": null,
"comment_count": 0,
"comments": "http://127.0.0.1:5000/api/v1.0/posts/3/comments/",
"id": 3,
"timestamp": "Wed, 24 Jun 2015 06:40:44 GMT",
"url": "http://127.0.0.1:5000/api/v1.0/posts/3"
}
],
"prev": null
}

请问怎样通过这样的JSON数据,实现下拉刷新加载更多,是要判断id吗?还是创建时间?或者输出怎样的JSON数据更方便一些?


数据

next字段可以不需要,客户端可以通过count字段计算出下一次请求的页码。
count字段只需要在获取第一页数据时返回。

逻辑要点

界面

下拉刷新上拉加载有一个很好用的库推荐https://github.com/CoderMJLee/MJRefresh

【热门文章】
【热门文章】