Wednesday, January 13, 2016

Self Sizing Cells with UITableView and UICollectionView

For a long time, a big challenge for iOS developers was custom heights and sizes for UITableView and UICollectionView Cells. There were ways to achieve this such as ‘Auto Layout’, but they were ‘hacky’ and not fully implemented.

Previously to calculate height, developers had two options.

If using Auto Layout, a developer could create an offscreen cell, layout the content in tableView:heightForRowAtIndexPath: and then get the height (using systemLayoutSizeFittingSize:).

If not using Auto Layout, the height has to be calculated manually for each cell and the values cached to avoid slowdown.

With iOS 8, UITableViews and UICollectionViews have embraced Auto Layout. In this post, we will cover what you need to know to support UITableViews in your apps.

Continue reading %Self Sizing Cells with UITableView and UICollectionView%


by Arvindh Sukumar via SitePoint

No comments:

Post a Comment