顯示我從JSON讀入數據到數組但是當我訪問數組的內容不會顯示它顯示了數兩項紀錄,但不顯示我想訪問喜歡的內容數據不是從數組
for (int i = 0; i<[tempArray count]; i++)
{
id *item = [tempArray objectAtIndex:i];
NSDictionary *dict = (NSDictionary *) item;
ObjectData *theObject =[[ObjectData alloc] init];
[theObject setUser_id:[dict objectForKey:@"user_id"]];
[theObject setSurvey_id:[dict objectForKey:@"survey_id"]];
[theObject setSurvey_title:[dict objectForKey:@"survey_Title"]];
[theObject setSurvey_Description:[dict objectForKey:@"survey_Description"]];
[theObject setDate_Created:[dict objectForKey:@"date_Created"]];
NSString*testing=[dict objectForKey:@"survey_id"];
NSLog(testing);
[surveyList addObject:theObject];
[theObject release];
theObject=nil;
int count =[surveyList count];
NSLog(@"Total is %d",count);
}
,
ObjectData*data=[surveyList objectAtIndex.path.row];
NSString*cellText=data.surveyDescription;
它不會顯示在任何CELLTEXT NSLog的時候,我 不知道爲什麼它是這樣的,因爲數組的內容。
tempArray: (
{
color = "[UIColor GrayColor]";
"date_created" = "2012-07-24 22:39:14";
"survey_description" = "Survey To get feedback from clients about food quality and any suggestion to improve the service";
"survey_id" = 1;
"survey_title" = "Resturant Survey";
"user_id" = ali40;
},
{
color = "[UIColor greyColor]";
"date_created" = "2012-07-25 00:43:42";
"survey_description" = "Toursim Survey";
"survey_id" = 2;
"survey_title" = "Travel Servey";
"user_id" = ali40;
}
)
你重裝填充陣列後的表格。 – ArunGJ 2012-07-26 09:11:18
這些NSLog產生了什麼? – 2012-07-26 09:11:59
請添加'NSLog(@「tempArray:%@」,tempArray);'這將告訴你數組的確切結構和它包含的對象,包括字典的鍵和它們的值。 – 2012-07-26 09:13:49