我有一个包含图像 URL 的数组,我想用这些 url 创建一个图像视图(现在使用 for 循环)。
但我不知道如何使用数组中的 URL 制作图像视图希望有人能澄清这一点
int x = 0;
for(int i = 0; i <imagearry.count; i ++){
NSDictionary *dict = [imagearry objectAtIndex:i];
NSLog(@"%@",[dict objectForKey:@"img_url"]);
NSString *filePath [NSHomeDirectory()stringByAppendingPathComponent:@"/Library/Caches"];
stringarry = [[imagearry objectAtIndex:i] objectForKey:@"img_url"];
int x = 0;
imageView.image = [UIImage imageNamed:[stringarry objectAtIndex:0]];
for(int i=0; i < [stringarry count]; i++)
{
UIImageView *img = [[UIImageView alloc] init];
img.bounds = CGRectMake(10, 10, 50, 50);
img.frame = CGRectMake(5+x, 0, 160, 110);
NSLog(@"image: %@",[stringarry objectAtIndex:i]);
img.image = [UIImage imageNamed:[stringarry objectAtIndex:i]];
[stringarry insertObject:img atIndex:i];
[scrollView addSubview:[stringarry objectAtIndex:i]];
x += 170;