如何在Xcode中显示JSON数组?
我得到了这个json响应,我为nsdictionary创建了一个对象,并将其保存为如何在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
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中分配内存并访问任意位置吗。