【问题标题】:QuickLook for images in iPhone在 iPhone 中快速查找图像
【发布时间】:2012-01-13 04:18:15
【问题描述】:

我正在下载一张知道图片网址的图片。现在我如何使用快速查看框架查看此图像。我正在使用以下代码下载。

UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL  
URLWithString:@"http://good-wallpapers.com/pictures/3048/frosty_apple_logo_iphone.jpg"]]];

如果我有 UIImages 的数组或字典,我应该怎么做才能快速查看呢?

【问题讨论】:

    标签: iphone quicklook


    【解决方案1】:

    滚动视图中的 UIimageview 可以很好地显示所有图像。下面是将数组中的所有图像加载到 UIscrollview 中的 UIimageView

    for (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 是图像数据的集合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-22
      • 2011-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多