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