Creating a grid view on iOS

ios

Solution

`UICollectionView` is available in iOS 6.0 and later, so it can't be used if you want to support earlier versions.

There are quite a open-source libraries that let you create grid views:

- KKGridView

- UIGridView

- AQGridView

- NRGridView

- MMGridView

- WCGridView

I am currently using `AQGridView`, and I've found it to be the most robust. It works just like a `UITableView`. Evadne Wu created a video and sample project showing how to use it.

Also, if you're trying to do this without using Interface Builder, keep in mind that it'll be a bit more difficult since you have to create the views programmatically.

Problem

I need to implement a grid view with dynamically-changing images. Most of the time, I use a `UITableView` to create a grid, but I run into memory issues if I have a large number of images. In iOS 6, the `UICollectionView` was added, but I've never used it before. What are some "best practices" and view subclasses to use when making a grid view so I don't have memory issues?

Original source

Related problems