如何显示X code。将JSON数组? [英] How to display an JSON array in Xcode?
本文介绍了如何显示X code。将JSON数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到这个JSON响应,我创建了一个NSDictionary的对象,并保存那里
I got this json response and i created an object for nsdictionary and saved there as
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
和下一步我保存为一个数组
and next step i saved as an array
NSArray *country=[json objectForKey:@"results"];
然后,我就在我的控制台以下结果。
And then i got the following result in my console.
2012-06-18 09:22:07.647 TableView[468:f803] (
{
"Countries" = Iceland;
"id"=9046567;
"name"=abceeeffdsg;
},
{
"Countries" = Greenland;
"id"=3524695;
"name"=gsfjgfsethju;
},
{
"Countries" = Switzerland;
"id"=4613583;
"name"=hdfkdgs;
)
但实际上我想在一个UITableView显示这些数据。谁能帮我做我的工作完成....感谢你的好意...
But actually i want to display these data in a UITableView. Can anyone help me make my work completed.... thanks for your kindness...
推荐答案
在实现代码如下数据源的方法
In the tableview datasource methods
1. numberof RowInSection use the [country count];
2. In the cellForRowAtIndexPath
cell.textLabel.text = [[country objectAtIndex:indexPath.row] objectForKey:@"Countries"];
让我知道如果你需要任何更多的细节。
Let me know if you need any more details.
这篇关于如何显示X code。将JSON数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文