Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically Make a SKLabelNode Bold in swift

As the title states - I would like to make my SKLabelNodebold programmatically.

How do I go about this?

like image 620
LukeTerzich Avatar asked Jan 27 '15 14:01

LukeTerzich


2 Answers

For SKLabelNode's you need to use:

var labelNode = SKLabelNode()
labelNode = SKLabelNode(fontNamed: "AvenirNext-Bold")

or

var labelNode = SKLabelNode()
labelNode.fontName = "AvenirNext-Bold"
like image 161
PoisonedApps Avatar answered Nov 18 '22 17:11

PoisonedApps


You can't set the SKLabelNode itself to bold. You have to use a Bold Font.

But if you want to use a custom font, you have to use one which is available in bold:

skLabel.fontName = "YourFontName-Bold"
skLabel.fontSize = 14

To get all fonts which are available on iOS check this site: http://iosfonts.com/

like image 4
Christian Avatar answered Nov 18 '22 16:11

Christian