UILabel width doesn't seem to be automatically adjusting

UILabel width doesn't seem to be automatically adjusting



I have two UILabel's, one for a temperature value and one for the degree's symbol. (It's because of the requirements of design that I have to have them as two separate labels instead of one).



My expectation is that when the temperature increases or decreases the overall width of the label would increase/decrease. I have a constraint that pins the degree symbol label to the right of the temperature so it seems to me that if the width of the temperature label increases/decreases then the degree symbol would move accordingly. Instead what it happening is the degree symbol position seems to remain static for some reason as you can see in the following two examples:



enter image description hereenter image description here



Here are the constraints of the temperature label:



enter image description here



Here are the constraints of the degree symbol label:



enter image description here



Is there something I need to do to the temperature label to make its with auto expand/contract?



EDIT: As requested, here is the temperature and degree symbol labels in relation to their containing view along with its constraints:



enter image description hereenter image description here






Can you upload the whole screenshot of the temperature screen....Then it will be better to understand constraints

– Keshav Raj
Sep 13 '18 at 17:29







The few constraint you've shown look good. But there has to be more. In "theory" you probably want to (a) pin the right anchor of the degree symbol while (b) allowing the left side of the temperature symbol to expand. So far you've posted neither of those constraints. At that point I might assume that you might be confusing the layout engine by using the centerXanchor. (Everything you've posted with top/centerY are superfluous as everything is fine vertically.)

– dfd
Sep 13 '18 at 17:31




1 Answer
1



Your problem is that you're aligning the leading space of the degree label , to the trailing of Feels like label , so whatever the width of temperature label the degree will be steady at it's place , so remove that constraint and instead hook the leading of degree to trailing of 120 ( primary heart label aka temperature label )



enter image description here



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

Node.js puppeteer - Use values from array in a loop to cycle through pages