Using Auto Layout, how do I make two labels on the same “line” be dynamic in their widths (adjusting with how wide each one needs to be)?

后端 未结 2 1817
忘了有多久
忘了有多久 2021-02-12 11:16

Say I have two UILabels, one is a URL and one is a timer:

[http://website.com/link/to/specific/story] [9m 42s]

But the \"timer\" UILabel change

2条回答
  •  醉酒成梦
    2021-02-12 11:25

    This is where compression resistance becomes important. Since the URL label needs to shrink first (in order to accommodate the space for the timer label), the compression resistance of the URL label should be lower than the compression resistance of the timer label (in horizontal direction, of course). You can easily set this attribute in IB.

提交回复
热议问题