解析JSON,让其中的数据显示在TableView上。
JSON内容如下:{
"exeFlag": "0",
"exeMsg": "OK",
"totalPage": 1,
"lstMaxData": (
{
"wkLogId": 444507,
"wklogTime": "2014-12-17T09:27:37.267",
"wklogType": 1,
"wklogTitle": "lalal",
"wklogContent": "dadada",
"createTime": null,
"loginName": null,
"displayName": "110",
"orgName": "组织1",
"workAdress": "aaaa"
},
{
"wkLogId": 444499,
"wklogTime": "2014-11-28T14:12:13.187",
"wklogType": 1,
"wklogTitle": "测试标题",
"wklogContent": "测试内容",
"createTime": null,
"loginName": null,
"displayName": "110",
"orgName": "组织1",
"workAdress": "aaaaaa"
}
)
}
具体操作思路如下:
1.JSON --> Dictionary 完成;
2.从Dictionary中根据 "lstMaxData" 获取jsonArray;
3.cellForRowAtIndexPath: cell.able.text = modle.property;
4.jsonArray --> modleArray -->tableData
通过- (void) getDataFromServer完成1、2步后,获取到了jsonArray只能在当前方法使用,-(void) viewDidLoad 方法中不能获取到jsonArray.
请各位多多指点。
You can create a dictionary to accept, where lstMaxData": corresponds to an array, and the elements in the array are another dictionary (you can create a model to accept this dictionary and load it into another array dataArray). When accessing, you can Accept the model of the array dataArray according to the row of the table, and then display it on the row
Initialize a dictionary, and then process this dictionary into some arrays or something as the data source of the tableview. After obtaining the data, assign the return value to that dictionary, and then reload the tableview