WWDC 2014 Session 226: What's New in Table and Collection Views
Adopting Dynamic Type
- Default labels already use dynamic type.
- Use
+[UIFont preferredFontForTextStyle:]
for custom labels.
Self-sizing Table View Cells
- Two options for self-sizing table cells:
- Autolayout constraints — add constraints to
cell.contentView
. - Manual sizing — override
-sizeThatFits:
.
- Autolayout constraints — add constraints to
- Set
UITableView
’sestimatedRowHeight
instead ofrowHeight
and setrowHeight
toUITableViewAutomaticDimension
on iOS 8 for self-sizing table cells.- In the current seed, table views unarchived from a NIB have their
rowHeight
property set to a constant height by default. This will change toUITableViewAutomaticDimension
in a future seed.
- In the current seed, table views unarchived from a NIB have their
Self-sizing Collection View Cells
- Same as table cells, use constraints or override
-sizeThatFits:
. - Override
-[UICollectionReusableView preferredLayoutAttributesFittingAttributes:]
to adjust layout attributes determined by theUICollectionViewLayout
. - New
estimatedItemSize
property onUICollectionViewFlowLayout
, equivalent toestimatedRowHeight
onUITableView
.
Invalidation Contexts
-
Fine grained invalidation methods:
-
Inform the collection view of a content-size change using the
contentSizeAdjustment
andcontentOffsetAdjustment
properties onUICollectionViewLayout
(deltas).