Finally I use the zoom that implements UIScrollView
. I added a UIScrollView
to my UICollectionViewCell
.
And I've set it up the minimumZoomScale
, maximumZoomScale
, zoomScale
of the UIScrollView
, and implemented the viewForZoomingInScrollView
UIScrollViewDelegate
method on my Custom UICollectionViewCell
, to get running the zoom
functionality in the UIScrollView
.
That's how looks the cellForItemAtIndexPath
: method of my UICollectionView
:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
SBQPhotosDetailCollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
cell.imageDetail=[[UIImageView alloc] initWithFrame:cell.bounds];
cell.imageDetail.contentMode=UIViewContentModeScaleAspectFit;
cell.scrollView.contentSize = CGSizeMake(cell.imageDetail.frame.size.width, cell.imageDetail.frame.size.height);
;
cell.imageDetail.transform = CGAffineTransformIdentity;
cell.scrollView.delegate=cell;
cell.scrollView.maximumZoomScale=4.0;
cell.scrollView.minimumZoomScale=1.0;
cell.scrollView.zoomScale=1.0;
[cell.scrollView addSubview:cell.imageDetail];
[cell.imageDetail setImageWithURL:[NSURL URLWithString:[self.arrayURLS objectAtIndex:indexPath.row]]
placeholderImage:[UIImage imageNamed:@"thunder"]];
cell.delegate = self;
return cell;
}