I recently had a requirement for a table of data in an app I was working on, that scrolls in both directions like a spreadsheet does. Surprisingly, a library to provide this does not currently exist. I created a solution to achieve this using a combination of a UICollectionView, embedded within a UIScrollView, with an additional UITableView to use as a legend on the left.
I haven’t gone as far as providing a complete library for this, but I have created a type called TwoDimensionalTable which can be configured with your data if you drop it into your app.
Details of how it works are in various comments throughout the code. To use it, just download the app and copy the contents of the TableFiles folder into your app. Then create a UIView in your storyboard, and set its type to TwoDimensionalTable. Drag this into your UIViewController, and call the ‘refresh’ func, passing in the data you wish to show.
You can customize the table by playing with the appearance of the two xib files – one for the UICollectionView cells, and one for the UITableView label cells. Obviously you can also just directly change the methods that create the cells for either.
The example project is in a github project here :