1

I'm building a photo gallery for an app that loads latest wall pictures from a facebook page. I've got a thumbnails gallery and a detail view much like many other photo galleries.

I found this nice little framework that manage downloading and presenting of the images in a scroll view with page control: https://github.com/AdrianFlorian/AFImageViewer

I just can't get my head around how to set the initial view if i dont want to start from index 0? That is, if the user taps an image "in the middle", I pass an integer to the framework class. But where does it go? Any hints would be very appreciated!

1 Answers1

0

Ok, finally found it. So obvious i feel a bit stupid about posting it..but maybe someone else is equally stupid and finds the information valuable.

Image viewer has a page control that have a property for current page, just set it to the index of your selected image and you're good to go.

imageViewer.pageControl.currentPage = *selected_image_integer*;

EDIT: Ok so it was not that simple. It does not scroll trough the images array properly. If you scroll "down" it always ends on the first selected image, some images get shown twice and sometimes they are in a different order.

  • Ok, i talked to mr Florian himself and he was kind enough to incorporate functionality into the framework for setting the initial image. Big thumbs up! The problem was that images get downloaded in order by which is shown in the page control and the added to an array. This way if you start at image 5 for example it will end up at index 0 in the array, image 4 and 6 at index 1 and 2 etc. The solution was to use a dictionary with index keys instead. – user1798843 Nov 15 '12 at 10:20