Displaying a double in a label that contains time makes the position jumpy

StackOverflow https://stackoverflow.com/questions/23672583

  •  23-07-2023
  •  | 
  •  

Pregunta

I couldn't think of a better way to title this, so hopefully the description helps.

I have a game in which the elapsed time is displayed at the top. As the time changes, different numbers have different physical sizes, so the physical length of the label changes very slightly for each fraction of a second. This makes it so the whole number doesn't appear to stay in the same place, and instead looks like it's vibrating in place. How can I make it so the displayed label appears more steady?

¿Fue útil?

Solución

I guess your label's textAlignment property is NSTextAlignmentCenter, Try to set the label's textAlignment property to NSTextAlignmentLeft or NSTextAlignmentRight.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top