我想获取具有配方 ID 的所有图像的数组,并希望将此图像数组传递给下一个 viewController,但我的问题是我只得到一个图像,我使用 recipeDC 作为实体类,对于所有图像的数组,我应该使用另一个实体类或者也可以使用同一个类来完成,我该怎么办,我卡住了请帮助我,
-(NSMutableArray *)getAllRecipiesByUserId:(RecipeDC *)recipeid
{
NSMutableArray *dataArray = [[NSMutableArray alloc] init];
NSString *url = [NSString stringWithFormat:@"%@get_all_recipies_by_user_id&user_id=%d",kWSURL,recipeid.user_id];
NSDictionary * returnDict = (NSDictionary *) [self callWebService:url];
if([returnDict objectForKey:@"response"])
{
NSDictionary * returnDictSuccess = (NSDictionary *) [returnDict objectForKey:@"response"];
NSArray *returnedDealArray = [returnDictSuccess objectForKey:@"recipies"];
RecipeDC *recpie = [[RecipeDC alloc] init];
for(NSDictionary *dealDict in returnedDealArray)
{
recpie.recipe_id=[[dealDict objectForKey:@"recipe_id"]intValue ];
recpie.category_id=[[dealDict objectForKey:@"category_id"]intValue ];
recpie.user_id=[[dealDict objectForKey:@"user_id"]intValue ];
recpie.recipe_name = [dealDict objectForKey:@"recipe_name" ];
recpie.recipe_detail = [dealDict objectForKey:@"recipe_detail"];
NSArray *img = [dealDict objectForKey:@"images"];
for(NSDictionary *dealDict in img)
{
recpie.recipie_img_id=[[dealDict objectForKey:@"recipe_images_id"]intValue];
recpie.recipe_id=[[dealDict objectForKey:@"recipe_id"]intValue];
recpie.recipie_img_url=[dealDict objectForKey:@"image_url"];
}
[dataArray addObject:recpie];
NSLog(@"arr count is %u",[dataArray count]);
}
}
return dataArray;
}