私はこの問題で立ち往生しています、JSOnの出力は
"forecast":[
{"day":"Today","condition":"MostlyClear","high_temperature":"94","low_temperature":"70"},
{"day":"Tomorrow","condition":"Sunny","high_temperature":"95","low_temperature":"69"},
{"day":"Saturday","condition":"Sunny","high_temperature":"94","low_temperature":"71"},
{"day":"Sunday","condition":"Sunny","high_temperature":"93","low_temperature":"70"},
{"day":"Monday","condition":"Sunny","high_temperature":"94","low_temperature":"70"}
]
テーブルビューセルに値を表示するには、条件キーが必要です。そして私のコードは
temp=[[NSString alloc] initWithData:[dataLoader httpData] encoding:NSUTF8StringEncoding];
NSLog(@"Patient Details %@",temp);
array = [[temp JSONValue] objectForKey:@"forecast"];
NSDictionary* dic = [array objectAtIndex:[indexPath row]];
NSString *strDay = [dic objectForKey:@"day"];
NSString *stringCondition = [dic objectForKey:@"condition"];
NSLog(@"condition is %@", stringCondition);
NSString *stringTemp = [dic objectForKey:@"high_temperature"];
NSString *stringLow = [dic objectForKey:@"low_temperature"];
ただし、条件値は1つしか表示されていません。一度に、5つの条件すべてが必要です。運が悪かったので、条件のNSArray
代わりに使ってみました。NSString