UIView-Encapsulated-Layout-Width / Height Constrained to Zero

后端 未结 1 934
盖世英雄少女心
盖世英雄少女心 2021-02-12 23:33

There are a number of stack overflow questions about auto-layout of UITableView cells and section headers / footers that concern the UIView-Encapsulated-Layou

1条回答
  •  渐次进展
    2021-02-12 23:55

    UIView doesn't have the intrinsic size hence width and height constraints needed. UIView-Encapsulated-Layout-Width and UIView-Encapsulated-Layout-Height are created by UICollectionView / UITableView initially. And later on sets the constraint constant based to the sizeForItem or heightForRowAtIndexPath delegate method. To ensure that UICollectionViewCell / UITableViewCell created in cellForItem / cellForRow method will be having the exact size.

    0 讨论(0)
提交回复
热议问题