1

我有从字典值中获取数据的内容数组,现在我需要在表格视图单元格中显示数组内容,但它没有显示正确的数据。

这是源代码

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";
    }

我需要在表格视图的内容中显示症状键

提前致谢

4

3 回答 3

0

制作一个自定义表格视图单元格并将所有数据放入其中。阅读这些教程以获取更多详细信息

http://www.galloway.me.uk/tutorials/custom-uitableviewcell/

http://www.e-string.com/content/custom-uitableviewcells-interface-builder

于 2012-05-10T06:57:04.240 回答
0

制作自定义表格视图,例如闪烁单元格或您可以使用的任何其他内容,如果可能,制作 plist 并传输数据,您可以更好地重复使用它如果您以这种方式找到任何查询,我会从这种方式获得结果告诉我,我将向您发送演示代码.....希望你能以这种方式得到你的解决方案

于 2012-05-10T07:11:24.427 回答
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);
于 2012-07-25T08:50:44.887 回答