0

I have a UICollectionView, and it works great, but I have a doubt. In my view I have a UICollectionViewCell and inside that I have a UIImage. The cell is linked to a blank view controller, and inside that I have a UIScrollView (for managing the zoom) and a UIImage (the full-size image).

I wondered if there was some delegate or something that could handle the image opening process automatically (with zoom, etc.).

Now I'm handling the zoom effect with UIScrollViewDelegate delegate and method viewForZoomingInScrollView:... but the result is very poor, definitely not fluid!

mattjgalloway
  • 34,792
  • 12
  • 100
  • 110
jacoz
  • 3,508
  • 5
  • 26
  • 42
  • Solution here: http://stackoverflow.com/questions/13049056/uicollectionview-and-images. – jacoz Oct 25 '12 at 15:39
  • wrong link...? this is linking this question – dineth Nov 07 '12 at 09:44
  • Oops, sorry: here is the link: http://stackoverflow.com/questions/13053486/uiscrollview-uiimage-and-zoom-not-fluid – jacoz Nov 07 '12 at 10:48
  • I want to do the same thing with you: the UICollectionView contains a UIScrollView, the UIScrollView contains a UIImageView. In the subclass of UICollectionView, I add viewForZoomingInScrollView(...), but it's not called. I don't know why. Could you give me some hint? – Autobots May 30 '13 at 06:09
  • I really can't help you... I'm definitely not a pro with Objective C, sorry! Try to open a new question, maybe you could refer to this question in order to give some more details – jacoz May 30 '13 at 14:00

1 Answers1

1

There's no built in view for doing what you want, no. You're doing the right thing with a UIImageView inside UIScrollView. If it's not very fluid, then it's likely because your image is huge. The way to get around that is to load different images for different zoom levels. So as you zoom in, listen to the UIScrollViewDelegate method called scrollViewDidZoom: and change the image to better resolution as you zoom in. Or, take a look at CATiledLayer.

Note that this has nothing to do with your UICollectionView.

mattjgalloway
  • 34,792
  • 12
  • 100
  • 110