<pre>
products = (
{
id = 19;
"image_url" = "http://localhost:8888/straightoffer/image/data/1330374078photography.jpg";
name = "Save $240 on your next photo session";
},
{
id = 21;
"image_url" = "http://localhost:8888/straightoffer/image/data/1330373696massage.jpg";
name = "One Hour Massage";
}
);
}
</pre>
上記は私がjsonを通して得たものです、私はuitableviewsに値を割り当てる必要があります:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@ "行数:%d"、[[products objectForKey:@ "products"] count]);
return [[products objectForKey:@ "products"] count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@ "cell"];
if(cell == nil){
セル=[[UITableViewCellalloc]
initWithStyle:UITableViewCellStyleDefault
restartIdentifier:@ "cell"];
}
NSString * currentProductName;
currentProductName = [productKeys objectAtIndex:indexPath.row];
NSLog(@ "製品名:%@"、currentProductName);
[[セルtextLabel]setText:currentProductName];
セルを返します。
}
行数が0を返します。私はiOSの初心者ですが、これらの値をuitableviewに割り当てる方法を教えてください。
よろしく