0

我没有回应

(
        {
        "first_name" = Akash;
        idprofile = 1;
        iduser = 1;
        "last_name" = Testing;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/1_Jellyfish.jpg";
        "profile_picture_filepath" = "1_Jellyfish.jpg";
    },
        {
        "first_name" = testing;
        idprofile = 3;
        iduser = 1;
        "last_name" = tst;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/3_Penguins.jpg";
        "profile_picture_filepath" = "3_Penguins.jpg";
    },
        {
        "first_name" = test;
        idprofile = 4;
        iduser = 1;
        "last_name" = test;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/4_Chrysanthemum.jpg";
        "profile_picture_filepath" = "4_Chrysanthemum.jpg";
    },
        {
        "first_name" = prashant1;
        idprofile = 19;
        iduser = 1;
        "last_name" = kharade1;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/19_Koala.jpg";
        "profile_picture_filepath" = "19_Koala.jpg";
    },
        {
        "first_name" = Priyank;
        idprofile = 68;
        iduser = 1;
        "last_name" = Jain;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/68_P.jpg";
        "profile_picture_filepath" = "68_P.jpg";
    },
        {
        "first_name" = sdasd;
        idprofile = 106;
        iduser = 1;
        "last_name" = sdasd;
        picUrl = "http://qalina.acapglobal.com/kangatime/ktapp/profilepics/1/";
        "profile_picture_filepath" = "<null>";
    }
)

在我做dis之后

NSMutableArray *fNames = [NSMutableArray array];

for(NSDictionary *temp in responseArr)
{
    [fNames addObject:[temp objectForKey:@"first_name"]];

}
 NSLog(@"fNamesArray==>%@",fNames);


NSMutableArray *lNames = [NSMutableArray array];

for(NSDictionary *temp1 in responseArr)
{
    [lNames addObject:[temp1 objectForKey:@"last_name"]];
}
NSLog(@"lNamesArray==>%@",lNames);

我明白了:

fNamesArray==>(Akash,测试,测试,prashant1,Priyank,sdasd)

lNamesArray==>( 测试, tst, test, kharade1, Jain, sdasd )

fNamesArray 由名字组成,lNamesArray 由姓氏组成。现在我要做的是组合两个数组(名字+姓氏)并将它们显示在与每个配置文件相关的表格和图像中,并显示在表格行上。

就像第一行应该包含

阿卡什测试

第二行

测试 tst

等等...

任何帮助,将不胜感激。谢谢!!

4

1 回答 1

0

最好在下面...

NSMutableArray *fullNames = [[NSMutableArray alloc] init];
for(NSDictionary *temp in responseArr)
{
    NSString *strFullName = [NSString stringWithFormat:@"%@ %@", [temp objectForKey:@"first_name"], [temp1 objectForKey:@"last_name"]];
    [fullNames addObject: strFullName]
}
 NSLog(@"fNamesArray==>%@",fullNames);

Inserted for related new question...

To get array from JSON response, How to create JSON Array string given below?

于 2012-10-16T08:50:59.053 回答