Expandable UITableView Cell using Autolayout results in UIViewAlertForUnsatisfiableConstraints

后端 未结 2 1863
鱼传尺愫
鱼传尺愫 2020-12-06 15:15

I am trying to make expandable cells using combination of UITableViewAutomaticDimension row height and Autolayout of the cells. To make things simple, I started

相关标签:
2条回答
  • 2020-12-06 15:51

    Setting the height constraint priority to 999 may feel like a hack, but according to Apple's docs:

    NOTE Don’t feel obligated to use all 1000 priority values. In fact, priorities should general cluster around the system-defined low (250), medium (500), high (750), and required (1000) priorities. You may need to make constraints that are one or two points higher or lower than these values, to help prevent ties. If you’re going much beyond that, you probably want to reexamine your layout’s logic.

    Probably a little less than intuitive:

    "I want the button height to control the cell height, so lower its priority????"

    But, that does appear to be the "correct" way to do it.

    Ref: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/AnatomyofaConstraint.html#//apple_ref/doc/uid/TP40010853-CH9-SW19

    0 讨论(0)
  • 2020-12-06 16:03

    Remove the height constraint i.e 200 as it is conflicting with top and bottom constraint.

    Hope it helps..

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