Suggestions on how to implement a scrollable thumbnail viewer?

My app stores data files from a thermal imager in the Documents folder. These files can be rendered into images (on a canvas). I’d like to provide a mechanism to scroll through thumbnails in the same way users can currently scroll through photos. There can be a lot of them (hundreds, perhaps thousands ultimately).

I can envision using a thread to read files ahead into a dynamic array of objects, but I’m not clear on the best way to simulate a seemingly infinite scrollable canvas. Has anyone solved this problem or have any suggestions?

You can use the ARiOSMobileCollectionView from @Antonio_Rinaldi -

There is a gif of it in action here: Working with Pictures - #10 by Jeremie_L


Thanks @Jason_King . Sorry for the tardy reply but after a bit, I’ve mostly got it working in my app.

@Antonio_Rinaldi - Maybe I found a bug in version 2.0.2. I would expect a section to be deleted when I call removeItem and remove all items from it but it doesn’t appear to work that way. I get a crash because I am removing the section from my dataSource when it’s empty.

From the debug log:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (4) must be equal to the number of sections contained in the collection view before the update (5), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). Collection view: <AR2XOJOCollectionView: 0x12d81ec00; baseClass = UICollectionView; frame = (0 69; 320 450); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600002d93f60>; layer = <CALayer: 0x6000023c2540>; contentOffset: {0, 0}; contentSize: {320, 2375}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x12ca10e20>; dataSource: <AR2XOJOCollectionViewController: 0x12ca10a90>>'

Also, will you port this to Android?

Canvas? Why not just use a table with a datasource that uses the array? You can create a custom cell for the table that has an image viewer.

I thought about that and if ARiOSMobileCollectionView doesn’t work out (or I have to implement something for Android someday) I will revisit it. My reason for contemplating a canvas was because I don’t know how well a table works with potentially thousands of entries and it seemed to me that a canvas solution would consume less memory (at the expense of more complicated management - like in the olden days of directly managing bitmap displays). But I’m a total newbie at IOS so perhaps this is not a valid worry.

If you use a datasource for the table it is very efficient. You can also put in a search field if there is a text field in your custom table cell.

I will take a look since I’m implementing some new features
Your DataSource implements the ARiOSMobileCollectionMoveItem interface?

For Android is still too early to say. Since I need it for a project of mine I will try.

Yes, I have implemented the MoveItem interface. It works until the condition where I delete all items in a section and then I delete the section in my data source. Then the app crashes with the error message I showed. If I don’t delete the section then it works. It displays the section name (I have implemented collection Header) but no items (this is not idea from the user’s perspective).

Otherwise your code is working very well and I am very happy with it.

I’ve added the missing functionality (as another interface to keep compatibility)

As soon the I complete the tests for the other new features I’ll publish the new release.

Thank you Antonio. Any idea when you’ll be able to publish the new release?

We are near :slight_smile:
Help is ready to be published, tomorrow I should have time to publish everything