Why does using headerReferenceSize with self-sizing cells in a collection view cause a crash in iOS 8?

后端 未结 1 1687
别那么骄傲
别那么骄傲 2021-02-19 10:40

I managed to figure out the approach for self-sizing collection view cells under iOS 8.

I want to do this as a part of a accessory view.

I get a crash ... the in

相关标签:
1条回答
  • 2021-02-19 11:13

    The best idea I have so far is based on this repository: https://github.com/algal/SelfSizingCellsDemo

    On line 50 of ViewController.swift we have label.preferredMaxLayoutWidth = 320 which produces a cell that fills the whole screen and wraps the lines if there is enough text. This would need to be changed to fit whatever size screen you are working with. Then after each section you would need to add enough text to fill that label like is done on line 20 let items = smallitems.componentsSeparatedByString(" ") + [onelongitem]

    The problem with this approach is that I don't yet know how I would put different views in that cell, besides text. This might work enough for your situation though.

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