【发布时间】:2015-06-10 07:23:52
【问题描述】:
我有以下代码来显示图像:
_image = [[imagesModel alloc] initFromURLWithString:imageURL completion:^(id model, JSONModelError *err) {
int x = 0;
int w = 1;
for (imageModel *img in _image.Images)
{
NSString *picString = [NSString stringWithFormat:picURL, img.filename];
NSLog(@"Images: %@", picString);
UIImage *getImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picString]]];
UIImageView *imageView2 = [[UIImageView alloc] initWithImage:getImage];
self.pictureScroll.contentSize = CGSizeMake(w * 123, 120);
imageView2.frame = CGRectMake(x * 123, 1, 120, 120);
x++;
w++;
[pictureScroll addSubview:imageView2];
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected)];
singleTap.numberOfTapsRequired = 1;
[imageView2 setUserInteractionEnabled:YES];
[imageView2 addGestureRecognizer:singleTap];
clicked = img.filename;
// hide the loader view
}
[HUD hideUIBlockingIndicator];
}];
当用户单击图像时,我希望用户转到一个新视图,在那里他们可以看到完整大小的图像(现在是缩略图)。
我现在打开一个新视图,但它会打开最后的图像 (Dùh)。 有谁知道如何解决这个问题,我的大脑现在一团糟:/
【问题讨论】:
-
请注意,除非 IDE 本身有问题,否则不应使用 xcode 标签。
标签: objective-c cocoa-touch uiimage