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)?

那年仲夏 提交于 2019-12-03 09:42:52

You should set the compression resistance, URL label must have lower value;

Set the horizontal space between labels to constant (for example zero or default);

Set width for each label and select "less than" or "greater that" relation, these values set limits for shrinking/expanding of the view.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!