Grid of images in iOS

10,271

Solution 1

I eventually went with an excellent control from CocoaControls called DTGridView, but it was a close second to GMGridView, which was a close second. I found GMGridView a tad too powerful.

One of the things I found relatively easy to do with DTGridView was to override -(void)drawRect to add a stacked stack effect using CoreGraphics.

Solution 2

Apple has sample code TiledScrollView.m that demonstrates how to do what you want to do. The guts of the tile reuse is in layoutSubviews. Obviously you will need to tweak it to your own tasks... but it's always nice to have some working code to start with ;-) Hope this helps.

Share:
10,271
Echilon
Author by

Echilon

Developer and sci-fi geek from England.

Updated on June 04, 2022

Comments

  • Echilon
    Echilon almost 2 years

    I want to create a TabItem in a TabBarController containing a grid of images which a user can select. I know I could use a TableViewController, but that would just show a long list, rather than rows of (for example) 3x4 images.

    Is this possible?

  • Norman H
    Norman H over 12 years
    I think this is what you may have been referring to in your answer? developer.apple.com/library/ios/#samplecode/ScrollViewSuite/‌​…
  • Echilon
    Echilon over 12 years
    This does look like an excellent starting point for anyone wanting to create a custom control, but in my case I went with one of the many GridView controls available.
  • Neal Ehardt
    Neal Ehardt over 12 years
    Thanks for the link to GMGridView. It's exactly what I needed.