我正在下载一张知道图片网址的图片。现在,我如何使用快速查看框架工作查看此图像。我使用以下代码下载。
UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL
URLWithString:@"http://good-wallpapers.com/pictures/3048/frosty_apple_logo_iphone.jpg"]]];
如果我有一个明智的阵列或UIImages,我应该怎么做才能快速查看..
答案 0 :(得分:2)
滚动视图中的UIimageview可以显示所有图像。下面是在UIscrollview
中将所有图像从数组加载到UIimageViewfor (UIView *v in [scrollView subviews]) {
[v removeFromSuperview];
}
CGRect workingFrame = scrollView.frame;
workingFrame.origin.x = 0;
for(id datavalue in tableList) {
UIImage *downloadedImage = [UIImage imageWithData:datavalue];
imageview = [[UIImageView alloc] initWithImage:downloadedImage];
[imageview.layer setBorderColor: [[UIColor grayColor] CGColor]];
[imageview.layer setBorderWidth: 2.0];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
imageview.frame = workingFrame;
[scrollView addSubview:imageview];
[imageview release];
workingFrame.origin.x = workingFrame.origin.x + workingFrame.size.width;
}
[scrollView setPagingEnabled:YES];
[scrollView setContentSize:CGSizeMake(workingFrame.origin.x, workingFrame.size.height)];
其中tablelist是图像数据的集合。