I am loading a tableview with the contents from web service using json frameworks in asynchronous connection. The data is in the json object form
{\"id\":1,\"f
You are going about this the wrong way. You want to create arrays and index them using indexpath.row. So you ll have only one line of assigning cell.textLabel.text. One solution is: Create an NSArray of objects beforehand containing your @"Name",@"E-Mail" etc. like:
NSArray *arr1=[NSArray arrayWithObjects:@"Name",@"Email",....,nil];
Then when you get the NSDictionary,store it in an array and enumerate through it like
NSMutableArray *arr2=[dictionaryData allValues];
for(id obj in arr2)
{
if([obj isKindOfClass:[NSString class]])
[arr2 addObject:obj];
else if([obj isKindOfClass:[NSDictionary class]])
{
[arr2 addObject:[obj valueForKey:@"Monthly"]];
[arr2 addObject:[obj valueForKey:@"Annual"]];
}
}
Then just use indexpath.row in cell.textLabel.text
cell.textLabel.text=[NSString stringWithFormat:@"%@ : %@",[arr1 objectAtIndex:indexPath.row],[arr2 objectAtIndex:indexPath.row]];
Of course there might be a better way specific to your case, but this should help you build that.