我有从字典值中获取数据的内容数组,现在我需要在表格视图单元格中显示数组内容,但它没有显示正确的数据。
这是源代码
for (int i = 0; i < [self.illArray count]; i++)
{
NSMutableDictionary *lDict = [self.illArray objectAtIndex:i];
NSString *lTitle = [lDict objectForKey:@"title"];
if ([lTitle rangeOfString:@"Symptoms"].length > 0)
{
[m_cIllResultArray addObject:lDict];
}
}
for (int i = 0; i < [m_cIllResultArray count]; i++)
{
sDict = [m_cIllResultArray objectAtIndex:i];
NSString *sDetail = [sDict objectForKey:@"SYMPTOMS"];
[sDict setValue:sDetail forKey:@"details"];
}
NSLog(@“ARRAY VALUES1: - %@”,[sDict valueForKey:@“details”]);
数据格式为:
ARRAY VALUES : (
{
SYMPTOMS = (
"Abdominal pain",
Constipation,
Diarrhea,
"Hard to breathe"
);
independentItem = 0;
module = 117;
seqCounter = 101;
sequence = 10010;
session = 101;
title = "Low Alert: Symptoms";
},
{
SYMPTOMS = (
"Abdominal pain",
Constipation,
Diarrhea
);
independentItem = 0;
module = 117;
seqCounter = 102;
sequence = 10022;
session = 101;
title = "High Alert : Symptoms";
},
{
SYMPTOMS = (
"Abdominal pain",
Dehydration,
"Elevated temperature (>100 degrees)"
);
independentItem = 0;
module = 117;
seqCounter = 101;
sequence = 10040;
session = 101;
title = "Low Alert: Symptoms";
}
我需要在表格视图中显示症状内容键
提前致谢
答案 0 :(得分:0)
创建一个自定义的tableview单元格并将所有数据放入其中。阅读这些教程了解更多详情
http://www.galloway.me.uk/tutorials/custom-uitableviewcell/
http://www.e-string.com/content/custom-uitableviewcells-interface-builder
答案 1 :(得分:0)
制作自定义tableview,例如闪烁单元格或任何其他你可以使用的,如果可能的话,制作plist并传输数据,你可以重用它更好我有这样的结果,如果你发现这样的任何查询告诉我,我会发送你演示代码.....希望你能以这种方式得到你的解决方案
答案 2 :(得分:0)
试试这个..我觉得它有用..
for (int i = 0; i < [self.illArray count]; i++)
{
NSMutableDictionary *lDict = [self.illArray objectAtIndex:i];
NSString *lTitle = [lDict objectForKey:@"title"];
if ([lTitle rangeOfString:@"Symptoms"].length > 0)
{
[m_cIllResultArray addObject:[sDict objectForKey:@"SYMPTOMS"]];
}
}
NSLog(@"ARRAY VALUES1:-%@", m_cIllResultArray);