<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>
the above is what I got through json, I need to assign the values to uitableviews:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSLog(@"Number of rows: %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) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"cell"];
}
NSString *currentProductName;
currentProductName = [productKeys objectAtIndex:indexPath.row];
NSLog(@"product name : %@", currentProductName);
[[cell textLabel] setText:currentProductName];
return cell;
}
it returns 0 number of rows, I am newbie to ios please help me how I will assign these values to uitableview.
Regards
productsdictionary?productsand show us..? if theproductsitself is the array you can just its count right?numberOfRowsInSection, whether theproductsis having values or nil