我正在尝试加载图像 - 我从 JSON - 字典中获取 URL
字典:api.amioamio.com/?v=1&id=2&pass=8d4a9a5648640eca8f8da4416d0f6999&cmd=getShop&p%5BshopId%5D=110
我写的时候工作得很好-但是如果我尝试使用字符串变量-它不能生成 imageURL
这是我的代码:
NSString *strURLTemp=[[NSString alloc] initWithFormat:@"[[[images objectForKey:@\"%@\"] objectForKey:@\"images\"] objectForKey:@\"small\"]",[keys objectAtIndex :0]];
NSLog(@"%@",strURLTemp);//[[[images objectForKey:@"78044"] objectForKey:@"images"] objectForKey:@"small"]
//NSURL *imageURL1 = [NSURL URLWithString:[[[images objectForKey:@"100256"] objectForKey:@"images"] objectForKey:@"small"]];
NSURL *imageURL1 = [NSURL URLWithString:strURLTemp];
NSData *imageData1 = [NSData dataWithContentsOfURL:imageURL1];
UIImage *img1 = [UIImage imageWithData:imageData1];
我怎样才能使这项工作?谢谢 !