0

I'm having some issues with the vertical alignment of different currencies for some in app purchases. My purchase labels all align perfectly in dollar figures, but for larger Japanese Yen figures they appear to be pushed up. The only difference appears to be the comma, but I'm unsure how to resolve this.

I'm aligning all my labels using

coinLabel.verticalAlignmentMode = .center

Thank you in advance!

US Example:
US Example
Yen Example:
Yen Example

Paulw11
  • 108,386
  • 14
  • 159
  • 186
Next
  • 13
  • 4

1 Answers1

1

You need to use .baseline, not .center as the , descends below the baseline. Using .center centers the entire text frame around the origin. Using .baseline places the baseline of the text at the origin and ensures that the descender does not impact the placement of the text in the node.

Paulw11
  • 108,386
  • 14
  • 159
  • 186
  • Perfect! Thanks for sending me on the right path. I was able to combine your answer with another to get it working http://stackoverflow.com/questions/38850592/spritekit-is-there-a-way-to-centre-a-sklabelnode-according-to-its-baseline – Next May 04 '17 at 11:04