使用asyncimageview加载图像

时间:2013-08-30 07:54:01

标签: ios objective-c

我有自定义单元格的tableview,其中有两个图像视图。

enter image description here

我使用asyncimageview从url加载图像。但是图像仅在imageview1上加载而不是在imageview2上加载。以下是我使用的代码

            AsyncImageView *lImageView = [[[AsyncImageView alloc] initWithFrame:cell.image1.frame] autorelease];
            lImageView.contentMode = UIViewContentModeScaleToFill;
            lImageView.clipsToBounds = YES;
            lImageView.tag = 1;

            AsyncImageView *lImageView1 = [[[AsyncImageView alloc] initWithFrame:cell.image2.frame] autorelease];
            lImageView1.contentMode = UIViewContentModeScaleToFill;
            lImageView1.clipsToBounds = YES;
            lImageView1.tag = 2;
            [cell.image1 addSubview:lImageView];
             [cell.image2 addSubview:lImageView1];


    AsyncImageView *lImageView = (AsyncImageView *)[cell.image1 viewWithTag:1];
   [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:lImageView];
                    lImageView.imageURL =[NSURL URLWithString:pathimage1];

    AsyncImageView *lImageView1 = (AsyncImageView *)[cell.image2 viewWithTag:2];
   [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:lImageView1];
                    lImageView1.imageURL =[NSURL URLWithString:pathimage2];

如何解决此问题?

提前致谢。

0 个答案:

没有答案