iOS Resolve UILabel Priority Conflict


Problem: When you use many labels inside a view, you maybe get a warning:

enter image description here

How can we fix this warning?

Solution: We calculate and set the priorities in order. The priorities must be different from labels. It means which is important will get higher priority. For example, in my case, I set the vertical priorities for my labels look like this:

I set the highest priority for 1st label and the lowest for 4th label.

enter image description here

enter image description here

In a ViewController, I think you're hard to see the effect of those priorities. However, it's very clearly with UITableViewCell + estimate cell height.

Hope this help.