WebOrCode
WebOrCode

Reputation: 7294

SKLabelNode set fontSize according to length of text

Is it posible to set fontSize on SKLabelNode to some dynamic value so that it is max allowed value so that whole text can be shown.

Upvotes: 0

Views: 374

Answers (1)

iYoung
iYoung

Reputation: 3622

Whenever the label is updated just call a method say :adjustLabel. In that

- (void)adjustLabel{
    label.text = //Your Text;
    label.fontSize = //Your fontSize; 
    label.position = // Your position;
    // whatever attributes of the label you want to change, add them here.
}

Upvotes: 2

Related Questions