Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Xcode中显示JSON数组?_Xcode_Arrays_Json - Fatal编程技术网

如何在Xcode中显示JSON数组?

如何在Xcode中显示JSON数组?,xcode,arrays,json,Xcode,Arrays,Json,我得到了这个json响应,我为nsdictionary创建了一个对象,并将其保存为 NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error]; 下一步我保存为数组 NSArray *country=[json objectForKey:@"results"]; 然后我在控制台中得到了以下结果 2012-06-18 09:22:0

我得到了这个json响应,我为nsdictionary创建了一个对象,并将其保存为

NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
下一步我保存为数组

NSArray *country=[json objectForKey:@"results"];
然后我在控制台中得到了以下结果

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中显示这些数据。谁能帮我完成我的工作。。。。感谢您的好意…

在tableview数据源方法中

1. numberof RowInSection use the [country count];
2. In the cellForRowAtIndexPath

    cell.textLabel.text = [[country objectAtIndex:indexPath.row] objectForKey:@"Countries"];

如果您需要更多详细信息,请告诉我。

哦,谢谢,但这不是我想要的。你能再读一遍这个问题吗?我在UITableView中添加行数和行计数没有问题。实际上,我无法将json数组中的数据获取到我的表中。。。而这不是代码。你能帮助我而不是给-ve分吗;谢谢你。。。。另一个疑问。。。在“-(void)fetchedData:(NSData*)responseData”之外,我无法访问此数组。你能帮我在这个..in.h文件中声明该数组,在viewdidload中分配内存并访问任意位置吗。