Countdown and constraints

macOS, Swift, storyboards


I have a label with minutes and seconds of a countdown. 00:00

I want it horizontally centered in the container and at a certain distance from the top. When I put those constraints, all the label moves when there is a new second as it tries to center: 00:01, 00:02... it creates and strange effect. I suppose that the correct behaviour would be to have the two points fixed in the center. How to use constraints in this case?

Answered by janabanana in 422033022

set the width wider than any width you might reasonably expect, taking into account differences in localization if you are localizing, and ignore the warning.

Try to set a fixed width for the label.

I tried that but it gives the warning: Fixed width constraints may cause clipping

Accepted Answer

set the width wider than any width you might reasonably expect, taking into account differences in localization if you are localizing, and ignore the warning.

Don't worry about this warning.

Did it work that way ?

Countdown and constraints
 
 
Q