views:

508

answers:

2
  1. I have a UIScrollView of size 320*460 and with content size 1024*1024.
  2. I can place 25 images of 256*256 in it with the 13th picture shown at the centre of the screen when it loades with bits of surrounding pictures around it.
  3. When i swipe to any side I want it to appear just like the mapView. With new images appearing and showing.

How can I do it?

A: 

Checkout the sample code called 'Tiling'. It might be what you're looking for.

Jessedc
I checked it. But no, its not infinite scrolling.
wolverine
A: 

When scrolling stops, couldn't you just adjust the bounds so that you are now "re-centered" with your new offset?

Presumably you can't scroll more than so many pixels before your finger hits the edge of the screen, so you only need bounds that a few hundred pixels outside the original center.

Once you have a new center, adjust your bounds accordingly, retiling as necessary.

Alex Reynolds
Ok, one doubt.In what i am doing, after placing each image, I am releasing its memory. When the scrollView loads, it shows all these images. But as u said when i does tiling, if i try to cache some of those images, wont it cause problems for me?
wolverine
I'm not sure what you mean, but you should probably release an image once it is outside the new bounds, adding new image tile references as needed.
Alex Reynolds
I'm still going to insist you look at how Tiling sample code and learn the ins and outs of it. As Alex points out the 'infinite scrolling' you're looking for is more of a visual effect than a function of UIScrollView.
Jessedc
As I mention in a comment for http://stackoverflow.com/questions/1493950/uiscrollview-any-thoughts-on-implementing-infinite-scroll-zoom `setContentOffset` cancels whatever scrolling is taking place, so on the face of it, this approach won't work.
Grumdrig