Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display multiple lines in SKLabelNode

Tags:

swift

I checked there is no properties for multiline in SKLabelNode. Is it possible to display multiple lines in SKLabelNode?

If no, Please give idea to display text in multilines.

like image 858
Govindaraj T Avatar asked Dec 04 '25 17:12

Govindaraj T


2 Answers

I use this bit of code to get multi lines of code with SKLabelNode. Multilines in a label-github

like image 82
Bill peek Avatar answered Dec 06 '25 09:12

Bill peek


There is a way now to do multi-line SKLabelNodes.

Set the property numberOfLines to 0. From Apple's documentation:

The default value is 1 (a single line). A value of 0 in interpreted as an unlimited number of lines. If the height of the text reaches the number of lines, the text will be truncated using the line break mode.

like image 27
Lucien Avatar answered Dec 06 '25 07:12

Lucien