【发布时间】:2017-09-17 01:02:06
【问题描述】:
我已经搜索了很多,但我无法找到解决方案,有人可以指导我寻找以下解决方案。
使用页面 1 的分页接收的 JSON 数据,依此类推。
"ErrorCode":null,
"Message":"Success",
"Data":[
{
"ProductID":1,
"ProductName" :"Mango",
"ProductCategory" :"Fruits"
},
{
"ProductID":2,
"ProductName" :"Banana",
"ProductCategory" :"Fruits"
},
{
"ProductID":3,
"ProductName" :"Fanta",
"ProductCategory" :"Drinks"
},
{
"ProductID":4,
"ProductName" :"Pepsi",
"ProductCategory" :"Drinks"
},
{
"ProductID":5,
"ProductName" :"Carrot",
"ProductCategory" :"Vegetables"
}
以上是我向上滚动时水果的示例数据,作为回报,我在使用分页时获得了多条记录,这是正确完成的,并且数据在表格视图中正确显示所有可用记录,如上所示。
我的要求是,我想为每个产品类别显示标题,例如标题将显示为水果,所有相关产品都将显示在下方。如果一次收到所有数据,我本可以这样做,但是当我们使用分页时,我不确定我在 json 响应中收到的下一页数据是否有另一个产品类别或相同的产品类别。
如果我的问题不清楚,请澄清。我希望做过分页的人知道我在说什么。
提前致谢。
【问题讨论】:
-
“我已经搜索了很多,但我无法找到解决方案”你花了多长时间?半秒?如果是这样,请继续搜索。或与具有使用搜索引擎运行搜索基本知识的朋友交谈。 SO 不是搜索服务。
-
你需要Objective C还是swift的代码?
标签: ios objective-c json uitableview paging