Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone IOS:集合视图图像位置更改_Iphone_Ios_Uicollectionview_Uicollectionviewcell - Fatal编程技术网

Iphone IOS:集合视图图像位置更改

Iphone IOS:集合视图图像位置更改,iphone,ios,uicollectionview,uicollectionviewcell,Iphone,Ios,Uicollectionview,Uicollectionviewcell,我正在使用UICollectionView显示从设备照片库加载的图像。我正在使用资源库加载图像。当我滚动UICollectionView时,图像正在更改它们在collection视图中的位置,而不是复制。因此,当我点击一个图像时,不同的图像正在加载。有什么帮助吗 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)inde

我正在使用UICollectionView显示从设备照片库加载的图像。我正在使用资源库加载图像。当我滚动UICollectionView时,图像正在更改它们在collection视图中的位置,而不是复制。因此,当我点击一个图像时,不同的图像正在加载。有什么帮助吗

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"Cell";
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

    UIImageView *GalleryImageView = (UIImageView *)[cell viewWithTag:100];
    url=@"";
    Document* doc = [galleryImages objectAtIndex:indexPath.row];
    GalleryImageView.contentMode = UIViewContentModeScaleAspectFill;
    url = doc.path;
    NSLog(@"%@",url);
    NSURL *referenceURL = [NSURL URLWithString:url];
    __block UIImage *returnValue = nil;
    [library assetForURL:referenceURL resultBlock:^(ALAsset *asset)
     {
         returnValue = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage]];
         GalleryImageView.image = returnValue;
         returnValue = nil;
         documentID= [dbutil getDocumentIDbyPath:url];
         GalleryImageView.tag = documentID;

     }
            failureBlock:^(NSError *error)
     {
         NSLog(@"error : %@", error);
     }];



    return cell;
    }

你能出示你的密码吗?