To use Dynamic Type in custom labels:
iOS 8 CellSizing
First the tableview uses an estimated cell size. Once the cell needs to be displayed in screen:
1) Create Cell
2) Size cell
3) Update contentsize
4) Display cell
– Using Autolayout, if constraints are determined unambiguously nothing needs to be done, the autolayout engine returns back the correct size.
– Manual-sizing: override
tableView.estimatedRowHeight instead of rowHeight
– If tableView comes from nib file or story board. RowHeight will be set when it comes out of the nib so you need to set:
tableView.rowHeight = UITableViewAutomaticDimension. this is the new default rowHeight.
Differences with iOS 7 on Dynamic sizing for Cells
This was called for ALL the cells on creation of the table view. So if we have 22000 cells to display this was called that many times. Cell size was difficult to provide, as the cell wasn’t created yet.
Works with estimated cell height, once the cell is about to be displayed on screen then the real size is calculated and can even be retrieved automatically from AutoLayout.
Self-sizing Cells in CollectionView FlowLayout
Very similar to table view using size instead of only height.
estimatedItemSize instead of itemSize.
iOS7 introduced invalidation contexts. Flow layout uses this for rotation, in iOS 8 used for self-sizing cells
iOS 8 improves on:
– floating headers
– avoid visual jumps with self-sizing cells
TODO: Research more about Invalidation contexts