我正在开发instragramm类型的应用程序,当用户点击像按钮我想在like arry中添加用户名 所以我在带有数组的字典中有一本字典。我正在尝试添加到like数组中的数组。
{
caption = "Shakira Shakira...";
comments = (
);
"display_name" = Shakira;
ext = "<null>";
"image_id" = 53;
likes = (
);
"post_type" = i;
"total_comments" = 0;
"total_likes" = 0;
"upload_dt" = 3wk;
"user_id" = 7;
"user_liked" = 0;
},
{
caption = "Addicted to Shakira???";
comments = (
{
comment = "love your profile :)";
"display_name" = Rihanna;
"user_id" = 5;
},
{
comment = "You are my favorite celebrity on Follow Me.";
"display_name" = Pitbull;
"user_id" = 4;
},
{
comment = "Looking Good!";
"display_name" = "Justin Bieber";
"user_id" = 2;
}
);
"display_name" = Shakira;
ext = "<null>";
"image_id" = 52;
likes = (
{
"display_name" = "Justin Bieber";
"user_id" = 2;
},
{
"display_name" = Rihanna;
"user_id" = 5;
},
{
"display_name" = Pitbull;
"user_id" = 4;
}
);
"post_type" = i;
"total_comments" = 3;
"total_likes" = 3;
"upload_dt" = 2mth;
"user_id" = 7;
"user_liked" = 0;
},
我想添加display_name和user_id
答案 0 :(得分:0)
NSMutableArray *mutearr = [NSMutableArray arrayWithArray:array];
这里的数组是NSArray,mutarr是NSMutablearray
答案 1 :(得分:0)
您可以使用addObjectsFromArray:来自NSMutableArray类
NSArray *animal = [[NSArray alloc]initWithObjects:@"Lion",@"Tiger",@"Dog",@"Cat",@"Sheep",@"Wolf", nil];
NSArray *color = [[NSArray alloc]initWithObjects:@"Blue",@"Red",@"Yellow",@"Green",@"Black", nil];
NSMutableArray *all = [[NSMutableArray alloc] init];
[all addObjectsFromArray:animal];
[all addObjectsFromArray:color];